public async Task <JsonResult> SaveData(WorkChangeViewModel works) { if (works.updated != null) { foreach (var item in works.updated) { _workService.Update(item); } } if (works.deleted != null) { foreach (var item in works.deleted) { _workService.Delete(item); } } if (works.inserted != null) { foreach (var item in works.inserted) { _workService.Insert(item); } } await _unitOfWork.SaveChangesAsync(); return(Json(new { success = true }, JsonRequestBehavior.AllowGet)); }
public ActionResult SaveData(WorkChangeViewModel works) { if (works.updated != null) { foreach (var updated in works.updated) { _workService.Update(updated); } } if (works.deleted != null) { foreach (var deleted in works.deleted) { _workService.Delete(deleted); } } if (works.inserted != null) { foreach (var inserted in works.inserted) { _workService.Insert(inserted); } } _unitOfWork.SaveChanges(); return(Json(new { Success = true }, JsonRequestBehavior.AllowGet)); }
public IActionResult DeleteWork(int id) { _workService.Delete(new Work { Id = id }); return(Json(null)); }
public IActionResult DeleteWork(int id) { var deletedmodel = _workService.Get(id); _workService.Delete(deletedmodel); return(Ok()); }
public IActionResult Remove(Guid workId) { if (User.IsInRole("Admin")) { _workService.Delete(workId); return(RedirectToAction("GetAll")); } return(RedirectToAction("Login", "Account", "")); }
//[ValidateAntiForgeryToken] public ActionResult DeleteConfirmed(int id) { Work work = _workService.Find(id); _workService.Delete(work); _unitOfWork.SaveChanges(); if (Request.IsAjaxRequest()) { return(Json(new { success = true }, JsonRequestBehavior.AllowGet)); } DisplaySuccessMessage("Has delete a Work record"); return(RedirectToAction("Index")); }
public async Task <IActionResult> Delete([FromQuery] Guid id) { var result = await _workService.Delete(id); if (result) { return(Ok()); } else { return(NotFound()); } }
public IActionResult Delete(int Id) { _workService.Delete(Id); return(Ok()); }
public async Task Delete([FromRoute] int id) { await _workService.Delete(id); }