public void CreateAAuthor(string firstName, string lastName) { using (var db = new PlayContext()) { db.Add(new Author { FirstName = firstName, LastName = lastName }); db.SaveChanges(); } }
public void CreateATheatre(string name, string location, int capacity) { using (var db = new PlayContext()) { db.Add(new Theatre { Name = name, Location = location, Capacity = capacity }); db.SaveChanges(); } }
public void CreateAPlay(string title, string bio, string genre, object author, object theatre) { int?theatreObjId = null; if (theatre != null) { theatreObjId = ((Theatre)theatre).TheatreId; } ; using (var db = new PlayContext()) { db.Add(new Play { Title = title, Bio = bio, Genre = genre, AuthorId = ((Author)author).AuthorId, TheatreId = theatreObjId }); db.SaveChanges(); } }