-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SQL database connected app service published
- Loading branch information
Showing
15 changed files
with
399 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,43 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using MyCloset.Data; | ||
using Microsoft.EntityFrameworkCore; | ||
using Azure.Storage.Blobs; | ||
using MyCloset.Models; | ||
using MyCloset.ViewModels; | ||
|
||
namespace MyCloset.Controllers | ||
{ | ||
public class MyClosetController : Controller | ||
{ | ||
// Database context | ||
private readonly Context _context; | ||
|
||
// Database context | ||
public MyClosetController(Context context) | ||
// Blob Account Container and Stoage | ||
private const string ContainerName = "mycloset"; | ||
private readonly BlobServiceClient _blobServiceClient; | ||
private readonly BlobContainerClient _containerClient; | ||
|
||
// Constructor | ||
public MyClosetController(Context context, BlobServiceClient blobServiceClient) | ||
{ | ||
_context = context; | ||
|
||
_blobServiceClient = blobServiceClient; | ||
_containerClient = _blobServiceClient.GetBlobContainerClient(ContainerName); | ||
} | ||
|
||
// Retrieve all clothing items from the database | ||
// Use asynchronous action to retrieve data from the database | ||
// Build the default closet view | ||
public async Task<IActionResult> Closet() | ||
{ | ||
// Clothing Items database set | ||
var ClothingItems = await _context.ClothingItems.ToListAsync(); | ||
|
||
// Wait until we get data back before returning the view | ||
return View(ClothingItems); | ||
var Closet = await _context.ClothingItems.ToListAsync(); | ||
|
||
// Create the MyCloset View Model | ||
var MyCloset = new ViewModels.MyClosetViewModel(); | ||
MyCloset.ClothingItems = Closet; | ||
MyCloset.BlobContainerUri = _containerClient.Uri; | ||
|
||
return View(MyCloset); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
MyCloset/Migrations/20250227182612_CroppedImageUrl-New-Col.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
MyCloset/Migrations/20250227182612_CroppedImageUrl-New-Col.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
|
||
#nullable disable | ||
|
||
namespace MyCloset.Migrations | ||
{ | ||
/// <inheritdoc /> | ||
public partial class CroppedImageUrlNewCol : Migration | ||
{ | ||
/// <inheritdoc /> | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.AddColumn<string>( | ||
name: "CroppedImageUrl", | ||
table: "ClothingItems", | ||
type: "nvarchar(max)", | ||
nullable: false, | ||
defaultValue: ""); | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.DropColumn( | ||
name: "CroppedImageUrl", | ||
table: "ClothingItems"); | ||
} | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
MyCloset/Migrations/20250301024623_Removing URL Columns.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
MyCloset/Migrations/20250301024623_Removing URL Columns.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
|
||
#nullable disable | ||
|
||
namespace MyCloset.Migrations | ||
{ | ||
/// <inheritdoc /> | ||
public partial class RemovingURLColumns : Migration | ||
{ | ||
/// <inheritdoc /> | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.DropColumn( | ||
name: "CroppedImageUrl", | ||
table: "ClothingItems"); | ||
|
||
migrationBuilder.DropColumn( | ||
name: "ImageUrl", | ||
table: "ClothingItems"); | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.AddColumn<string>( | ||
name: "CroppedImageUrl", | ||
table: "ClothingItems", | ||
type: "nvarchar(max)", | ||
nullable: false, | ||
defaultValue: ""); | ||
|
||
migrationBuilder.AddColumn<string>( | ||
name: "ImageUrl", | ||
table: "ClothingItems", | ||
type: "nvarchar(max)", | ||
nullable: false, | ||
defaultValue: ""); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
namespace MyCloset.Models | ||
{ | ||
// There is only one instance of the doll object | ||
public class Doll | ||
{ | ||
// List of the clothing items currently displayed on the doll | ||
// only one of each clothing type will be selected at each time, enforced by the selector functions | ||
public List<ClothingItem> ClothingItems { get; set; } | ||
|
||
// Default Constructor | ||
public Doll() | ||
{ | ||
// TODO: add default clothing | ||
ClothingItems = new List<ClothingItem>(); | ||
} | ||
|
||
// Function to select / replace clothing items | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.