public IActionResult Post(CreateViewModel model) { if (this.ModelState.IsValid) { Employee employee = model.ToEntity(this.GetCurrentUserName()); this.Storage.GetRepository <IEmployeeRepository>().Create(employee); this.Storage.Save(); return(Ok(new { success = true })); } return(BadRequest(new { success = false })); }
public ActionResult Create(CreateViewModel model) { if (this.ModelState.IsValid) { Employee employee = model.ToEntity(); this.Storage.GetRepository <IEmployeeRepository>().Create(employee, this.GetCurrentUserName()); this.Storage.Save(); return(RedirectToAction("Index")); } return(View(model)); }