Beispiel #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"));
        }
Beispiel #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));
            }
        }
Beispiel #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, "删除成功"));
        }
Beispiel #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"));
 }
Beispiel #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;
            }));
        }
Beispiel #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));
        }
Beispiel #10
0
 public ActionResult OnPostDelete(int modelId)
 {
     _branchService.Delete(modelId);
     return(CustomRedirect(SitePages.MajorEditorBranchesIndex));
 }
Beispiel #11
0
 public IActionResult Delete(int id)
 {
     _branchService.Delete(id);
     return(Ok());
 }
Beispiel #12
0
        public async Task <IActionResult> Delete(int id)
        {
            await _branchService.Delete(id);

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

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