Click here to Skip to main content
15,921,941 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello I'm new to asp.net mvc 3 and trying to build my first project which will be a rental site I'm wondering how you would structure it. I have these classes right now



C#
public class Member
  {
      public virtual int MemberId { get; set; }
      public virtual int Name { get; set; }
      public virtual List<Rental> Rentals { get; set; }
  }
  public class Movie
  {
      public virtual int MovieId { get; set; }
      public virtual string Name { get; set; }
  }
   public class Rental
  {
      public virtual int RentalId { get; set; }
      public virtual int MovieId { get; set; }
      public virtual int MemberId { get; set; }
      public virtual Member Member { get; set; }
      public DateTime dueDate {get; set;}
      public DateTime startDate { get; set; }
      public DateTime endDate { get; set; }
   }

I'm wondering how you would implement so it wouldn't be possible to rent a movie which is already rented. Right now I can rent a movie and then rent the same movie again. I did a similiar project just in a C# where we checked if the dueDate was null and if it was the movie was rented out.
Posted

ah yes sorry I'm using ASP.NET MVC 3 and EF Code First to create the database scheme.
 
Share this answer
 
ASP.NET and ASP.NET MVC are two different things. I think you're using Entity Framework, to show us a DB as classes, which is something else again.

You are not storing anywhere if the movie was returned. So, that's a problem. Once you add that flag to the Rental table, you can search it to see if a movie is out.
 
Share this answer
 
Comments
fjdiewornncalwe 12-Dec-12 16:37pm    
+5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900