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