public IActionResult New(NewTemplateModel model) { if (String.IsNullOrWhiteSpace(model.Template.CallName) && String.IsNullOrWhiteSpace(model.Template.CallNature)) { model.Message = "You must specify a call name and/or call nature to set to save the template"; return(View(model)); } if (ModelState.IsValid) { model.Template.DepartmentId = DepartmentId; model.Template.CreatedOn = DateTime.UtcNow; model.Template.CreatedByUserId = UserId; _templatesService.SaveCallQuickTemplate(model.Template); return(RedirectToAction("Index")); } return(View(model)); }
public IActionResult New() { var model = new NewTemplateModel(); model.Template = new CallQuickTemplate(); var priorites = _callsService.GetCallPrioritesForDepartment(DepartmentId); model.CallPriorities = new SelectList(priorites, "DepartmentCallPriorityId", "Name", priorites.FirstOrDefault(x => x.IsDefault)); List <CallType> types = new List <CallType>(); types.Add(new CallType { CallTypeId = 0, Type = "No Type" }); types.AddRange(_callsService.GetCallTypesForDepartment(DepartmentId)); model.CallTypes = new SelectList(types, "Type", "Type"); return(View(model)); }