public ActionResult Create(RequestOvertimeCreateViewModel model) { if (this.ModelState.IsValid) { RequestOvertime requestOvertime = model.ToEntity(); this.Storage.GetRepository <IRequestOvertimeRepository>().Create(requestOvertime, this.GetCurrentUserName()); this.Storage.Save(); return(RedirectToAction("Index")); } return(View(model)); }
public async Task <IActionResult> PostAsync(RequestOvertimeCreateViewModel model) { if (this.ModelState.IsValid) { RequestOvertime requestOvertime = model.ToEntity(); var repo = this.Storage.GetRepository <IRequestOvertimeRepository>(); //var imageUrl = await _imageService.UploadImageAsync(model.Image); //requestOvertime.ImageUrl = imageUrl.ToString(); repo.Create(requestOvertime, GetCurrentUserName()); this.Storage.Save(); return(Ok(new { success = true })); } return(BadRequest(new { success = false })); }