public ActionResult Create(QuickLeaveCreateViewModel model) { if (this.ModelState.IsValid) { QuickLeave quickLeave = model.ToEntity(); this.Storage.GetRepository <IQuickLeaveRepository>().Create(quickLeave, this.GetCurrentUserName()); this.Storage.Save(); return(RedirectToAction("Index")); } return(View(model)); }
public IActionResult Post(QuickLeaveCreateViewModel model) { if (this.ModelState.IsValid) { QuickLeave quickLeave = model.ToEntity(); quickLeave.GetTotalTimeTaken(); var repo = this.Storage.GetRepository <IQuickLeaveRepository>(); repo.Create(quickLeave, GetCurrentUserName()); this.Storage.Save(); return(Ok(new { success = true })); } return(BadRequest(new { success = false })); }