Esempio n. 1
0
        public async Task <IActionResult> Delete(int id)
        {
            var result = await _branchService.Delete(id);

            if (!result.Success)
            {
                return(BadRequest(result));
            }
            return(Ok(result));
        }
        public IActionResult Delete(int id)
        {
            var entity = _branchService.GetById(id);

            if (entity != null)
            {
                _branchService.Delete(entity);
            }

            return(RedirectToAction("BranchList"));
        }
Esempio n. 3
0
        public async Task <JsonResult> DeleteBranch(Guid id)
        {
            try
            {
                await _branchService.Delete(id);

                return(await Task.FromResult(Json(new { success = true })));
            }
            catch (Exception e)
            {
                return(await Task.FromResult(Json(new { success = false, ErrorMessage = "Помилка видалення. " + (e.InnerException ?? e).Message })));
            }
        }
        public IActionResult Delete(Branch branch)
        {
            var result = _branchService.Delete(branch);

            if (result.Success)
            {
                return(Ok(result.Message));
            }
            else
            {
                return(BadRequest(result.Message));
            }
        }
Esempio n. 5
0
        public ActionResult BranchDeleteProvide(Guid id)
        {
            if (!base.HasPermission("branch", PermissionOperate.delete))
            {
                return(JsonMessage(false, "你没有删除周边网点的权限"));
            }

            Branch branch = _branchService.GetById(id);

            _branchService.Delete(id.ToString());
            base.AddLog(string.Format("删除周边网点[{0}]成功", branch.Name), AdminLoggerModuleEnum.Branch);
            return(JsonMessage(true, "删除成功"));
        }
Esempio n. 6
0
        public async Task <IActionResult> DeleteTerminalDetails(int id)
        {
            var currentBranch = await branchService.FindAsync(id);

            if (currentBranch == null)
            {
                return(NotFound());
            }

            await branchService.Delete(currentBranch);

            await branchService.SaveChangesAsync();

            return(Ok());
        }
 public ActionResult Delete(BranchViewModel viewModel)
 {
     if (ModelState.IsValid)
     {
         var result = _branchService.Delete(viewModel.BranchId);
         if (result.Success)
         {
             Success(result.Results.FirstOrDefault().Message);
             ModelState.Clear();
         }
         else
         {
             _logger.Warn(result.Results.FirstOrDefault().Message);
             Warning(result.Results.FirstOrDefault().Message, true);
         }
     }
     return(RedirectToAction("Index"));
 }
Esempio n. 8
0
        public HttpResponseMessage Delete(HttpRequestMessage request, int id)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;
                if (ModelState.IsValid)
                {
                    request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
                }
                else
                {
                    _branchService.Delete(id);
                    _branchService.SaveChanges();

                    response = request.CreateResponse(HttpStatusCode.OK);
                }
                return response;
            }));
        }
Esempio n. 9
0
        public JsonResult Delete(int id)
        {
            string msg = "";

            try
            {
                var result = _branchService.Delete(id);
                if (result == true)
                {
                    msg = "OK";
                }
                else
                {
                    msg = "ERROR";
                }
            }
            catch (Exception ex)
            {
                ex.ToString();
            }
            return(Json(msg, JsonRequestBehavior.AllowGet));
        }
Esempio n. 10
0
 public ActionResult OnPostDelete(int modelId)
 {
     _branchService.Delete(modelId);
     return(CustomRedirect(SitePages.MajorEditorBranchesIndex));
 }
Esempio n. 11
0
 public IActionResult Delete(int id)
 {
     _branchService.Delete(id);
     return(Ok());
 }
Esempio n. 12
0
        public async Task <IActionResult> Delete(int id)
        {
            await _branchService.Delete(id);

            return(Ok());
        }
Esempio n. 13
0
        public IHttpActionResult Delete(int id, int userId)
        {
            int result = _service.Delete(id, userId);

            return(Ok());
        }
Esempio n. 14
0
 public ActionResult Delete(Guid id)
 {
     branchService.Delete(id);
     return(RedirectToAction("Index"));
 }
 public void Delete(Branch obj)
 {
     _service.Delete(obj);
 }
Esempio n. 16
0
 public SuccessResponse Delete(DeleteBranchRequest request)
 {
     return(_branchService.Delete(request));
 }
Esempio n. 17
0
 public JsonResult Delete(int id)
 {
     _branchService.Delete(id);
     return(new JsonFactory().Success(MessageConstants.Delete));
 }
Esempio n. 18
0
 public async Task <ActionResult <bool> > Delete(int id)
 {
     return(Ok(await _branchService.Delete(await GetUserId(),
                                           id,
                                           GetPermissionId())));
 }