コード例 #1
0
        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));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
 public IActionResult DeleteWork(int id)
 {
     _workService.Delete(new Work {
         Id = id
     });
     return(Json(null));
 }
コード例 #4
0
        public IActionResult DeleteWork(int id)
        {
            var deletedmodel = _workService.Get(id);

            _workService.Delete(deletedmodel);
            return(Ok());
        }
コード例 #5
0
        public IActionResult Remove(Guid workId)
        {
            if (User.IsInRole("Admin"))
            {
                _workService.Delete(workId);
                return(RedirectToAction("GetAll"));
            }

            return(RedirectToAction("Login", "Account", ""));
        }
コード例 #6
0
        //[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"));
        }
コード例 #7
0
        public async Task <IActionResult> Delete([FromQuery] Guid id)
        {
            var result = await _workService.Delete(id);

            if (result)
            {
                return(Ok());
            }
            else
            {
                return(NotFound());
            }
        }
コード例 #8
0
 public IActionResult Delete(int Id)
 {
     _workService.Delete(Id);
     return(Ok());
 }
コード例 #9
0
ファイル: WorkController.cs プロジェクト: uyen-luu/3-tier
 public async Task Delete([FromRoute] int id)
 {
     await _workService.Delete(id);
 }