public bool CreateTheater(TheaterCreate model) { var entity = new Theater() { OwnerId = _userId, TheaterName = model.TheaterName, TheaterLocation = model.TheaterLocation, CreatedUtc = DateTimeOffset.Now }; using (var ctx = new ApplicationDbContext()) { ctx.Theater.Add(entity); return(ctx.SaveChanges() == 1); } }
public ActionResult Create(TheaterCreate model) { if (!ModelState.IsValid) { return(View(model)); } var service = CreateTheaterService(); if (service.CreateTheater(model)) { TempData["SaveResult"] = "Your note was created."; return(RedirectToAction("Index")); } ; ModelState.AddModelError("", "Theater could not be created."); return(View(model)); }