コード例 #1
0
        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));
        }
コード例 #2
0
 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());
 }
コード例 #3
0
 public async Task <ActionResult <Shift> > DeleteCgiShift(int id)
 {
     try
     {
         return(Ok(_shiftService.Delete(id)));
     }
     catch (Exception e)
     {
         return(BadRequest(new { message = e.Message }));
     }
 }
コード例 #4
0
ファイル: ShiftController.cs プロジェクト: MirenShrestha/ERP
 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));
     }
 }