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")); }
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)); } }
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, "删除成功")); }
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")); }
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; })); }
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)); }
public ActionResult OnPostDelete(int modelId) { _branchService.Delete(modelId); return(CustomRedirect(SitePages.MajorEditorBranchesIndex)); }
public IActionResult Delete(int id) { _branchService.Delete(id); return(Ok()); }
public async Task <IActionResult> Delete(int id) { await _branchService.Delete(id); return(Ok()); }
public IHttpActionResult Delete(int id, int userId) { int result = _service.Delete(id, userId); return(Ok()); }
public ActionResult Delete(Guid id) { branchService.Delete(id); return(RedirectToAction("Index")); }
public void Delete(Branch obj) { _service.Delete(obj); }
public SuccessResponse Delete(DeleteBranchRequest request) { return(_branchService.Delete(request)); }
public JsonResult Delete(int id) { _branchService.Delete(id); return(new JsonFactory().Success(MessageConstants.Delete)); }
public async Task <ActionResult <bool> > Delete(int id) { return(Ok(await _branchService.Delete(await GetUserId(), id, GetPermissionId()))); }