public ActionResult SaveData(ShiftChangeViewModel shifts) { if (shifts.updated != null) { foreach (var updated in shifts.updated) { _shiftService.Update(updated); } } if (shifts.deleted != null) { foreach (var deleted in shifts.deleted) { _shiftService.Delete(deleted); } } if (shifts.inserted != null) { foreach (var inserted in shifts.inserted) { _shiftService.Insert(inserted); } } _unitOfWork.SaveChanges(); return(Json(new { Success = true }, JsonRequestBehavior.AllowGet)); }
public IHttpActionResult SoftDelete(int id) { try { _shiftService.Delete(id, DeleteState.SoftDelete); } catch (LogicalException ex) { return(BadRequest(ex.Message)); } catch { return(BadRequest(AppSettings.INTERNAL_SERVER_ERROR_MESSAGE)); } return(Ok()); }
public async Task <ActionResult <Shift> > DeleteCgiShift(int id) { try { return(Ok(_shiftService.Delete(id))); } catch (Exception e) { return(BadRequest(new { message = e.Message })); } }
public ActionResult Delete(string id) { try { var result = iShift.Delete(id); return(Json(new { ErrorCode = result.ErrorCode, Message = result.Msg, Id = result.Id, JsonRequestBehavior.AllowGet })); } catch (Exception ex) { return(Json(new { ErrorCode = 1, Message = ex.Message }, JsonRequestBehavior.AllowGet)); } }