Question
THIS INFO BELOW IS WHAT I WAS PROVIDED. PLEASE SEE QUESTION AT VERY BOTTOM UNDER LINE OF ''----------'' PLEASE HELP You've been provided a starting
THIS INFO BELOW IS WHAT I WAS PROVIDED. PLEASE SEE QUESTION AT VERY BOTTOM UNDER LINE OF ''----------'' PLEASE HELP
You've been provided a starting project. The Album and Publisher models have been created as well as the IAlbumList, AlbumList, IPublisherList and PublisherList. These have been registered with services Container and are ready to be injected. I Will attach all the data below for your reference
ALBUMS.CS
//If property is named Id //.Net assumes this is the primary key [Key] public int Id { get; set; } //This means they have to type an album title [Required(ErrorMessage = "Album Title cannot be blank")] [Display(Name = "Album Title")] public string Title { get; set; } [StringLength(50, ErrorMessage = "Artist cannot be more than 50 characters")] public string Artist { get; set; } [Required(ErrorMessage = "Genre cannot be blank")] public string Genre { get; set; } [Required(ErrorMessage = "Price cannot be blank")] //This means price can have 5 total digits and two past the decimal point [Column(TypeName = "decimal(5, 2)")] //Range Attribute takes a starting and an upperbound and it will check //that Price is in this range [Range(0, 999.99)] public decimal Price { get; set; } public int PublisherId { get; set; }
PUBLISHER.CS
public class Publisher { public int Id { get; set; } public string Name { get; set; } public string City { get; set; } public string Country { get; set; } }
IALBUMLIST.CS
public interface IAlbumList { List
ALBUMLIST.CS
public class AlbumList : IAlbumList { int idCounter = 1; List
IPUBLISHERLIST.CS
public interface IPublisherList { List
PUBLISHERLIST.CS
public class PublisherList : IPublisherList { List
public PublisherList() { publishers = new List
};
public List
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
THIS IS THE TASK
You have been provided a starting project. It is a .Net 6 MVC Application. The Album and Publisher Models have been created as well as the IAlbumList, AlbumList, IPublisherList and Publisher list. These have been registered with Services container and are ready to be injected.
A. Create an AlbumController with the following Actions and Views
1. Use Dependency Injection to add the AlbumList and the Publisher list to the Controller
- I have this so far: private List
public AlbumController(IAlbumList albumList, IPublisherList publisherList) { albums = albumList.GetAlbums(); publisher = publisherList.GetPublishers(); }
B. Index() endpoint Shows each of the albums info in a View - This has 5 parts
1. Provide links to the following actions for each album
2. Edit, Details, Delete
3. Add a select to the top of the view with each distinct price that will filter by price when the user chooses a price.
4. Include the Name of the publisher for each album on the Index View
5. Add a select to the top of the view with each distinct publisher that will filter by publisher when the user chooses a publisher.
C. Details(int Id) Show the information of one album
1. On the details view provide access to Edit, Delete and back to List (index)
2. Include the Publisher Name and City on the Album/Details view
D. Edit(int id) Allows the information about the album to be changed GET and POST 20 points
1. Do not allow the user to change the publisher.
2. Include the publisher Name and City on the Album/Details view
E. Create() Allows the user to create a new album GET and POST
1. In the create view pass a list of all the publishers and allow the user to choose the publisher from a select when creating a new album.
F. AlbumsByPublisher(int publisherId)
1. Create an endpoint that takes a publisherId and displays all albums with a matching publisherId
G. Create a PublisherController
1. Use Dependency Injection to add the AlbumList and the Publisher list to the Controller
2. Index() endpoint Show each of the publishers information in a view
Add a button that will Order the publishers by Name to the top of the Index View.
When a publisher is clicked on send the user to a view that shows all the Albums that publisher has published.
H. Calculate Average Price by Publisher. Your record store feels that some publishers are setting prices too high. You have been asked by your boss to compile some data to investigate this issue. You may do this in either Controller or even create a new Controller to make this calculation.
1. Display each of the publishers names as well as the total number of albums they have published, total cost of the albums and average cost in an HTML View.
2. Keep in mind that in our sample project the publishers are assigned at random so you will get different results each time you run the application.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started