public bool CreateScheduleUser(ScheduleUserCreate model)// some logic must go here to make appointment comply with shop hours. { var entity = new ScheduleUser() { UserID = _userId, ServiceID = model.ServiceID, StartTime = model.StartTime, UserName = model.UserName, UserNumber = model.UserNumber }; using (var ctx = new ApplicationDbContext()) { ctx.ScheduleUser.Add(entity); return(ctx.SaveChanges() == 1); } }
public ActionResult Create(ScheduleUserCreate model) { if (!ModelState.IsValid) { return(View(model)); } var service = new ScheduleUserService(Guid.Parse(User.Identity.GetUserId())); if (service.CreateScheduleUser(model)) { TempData["SaveResult"] = "Your Appointment was created."; return(RedirectToAction("Index2", "ScheduleUser", new { id = model.UserID })); //figure this out send to shop schedule!!!!!!! } ; ModelState.AddModelError("", "Appointment could not be created."); return(View(model)); }