示例#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));
 }
        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"));
        }
        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
 public async Task Delete([FromRoute] int id)
 {
     await _workService.Delete(id);
 }