public int CreateScheduleAdmin(ScheduleAdminCreate model)// some logic must go here to make appointment comply with shop hours. { var entity = new ScheduleAdmin() { ShopID = model.ShopID, EventID = model.EventID, EventName = model.EventName, StartTime = model.StartTime, EndTime = model.EndTime, CreatedUtc = DateTimeOffset.Now }; using (var ctx = new ApplicationDbContext()) { ctx.ScheduleAdmin.Add(entity); if (ctx.SaveChanges() == 1) { return(entity.EventID); } else { return(0); } } }
public ActionResult Create(ScheduleAdminCreate model) { if (!ModelState.IsValid) { return(View(model)); } var service = new ScheduleAdminService(model.ShopID); var result = service.CreateScheduleAdmin(model); if (result != 0) { TempData["SaveResult"] = "Your Admin Event was created."; return(RedirectToAction("Details", "ScheduleAdmin", new { id = result })); //figure this out send to shop schedule!!!!!!! } ; ModelState.AddModelError("", "Admin Event could not be created."); return(View(model)); }