// GET: CategoryController/Delete/5 public async Task <ActionResult> Delete(int id) { var Token = HttpContext.Session.GetString("Token"); if (_userClient.CheckToken(Token, User.Identity.Name) == null) { return(Redirect("/Administration/Home/Login")); } else { if (Token == null) { Token = await _userClient.CheckToken(Token, User.Identity.Name); } } var result = await _categoryApi.Delete(Token, id); if (result > 0) { return(Content("Success")); } else { return(Content("Error")); } }
public async Task <IActionResult> Delete(int categoryId) { bool status = false; status = await _categoryApiClient.Delete(categoryId); return(Json(new { status = status })); }
public async Task <ApiResult <bool> > Delete(int id) { var result = await _categoryApiCilent.Delete(id); if (result.IsSuccessed) { TempData["Result"] = result.Message; } return(result); }
public async Task <IActionResult> Delete(int id, string pageIndex) { var result = await _categoryApiClient.Delete(id); if (result.IsSuccess) { TempData["result"] = "Xóa loại sản phẩm thành công"; return(RedirectToAction("Index", new { pageIndex = !string.IsNullOrWhiteSpace(pageIndex) ? int.Parse(pageIndex) : 1 })); } TempData["error"] = result.Message; return(RedirectToAction("Index", new { pageIndex = !string.IsNullOrWhiteSpace(pageIndex) ? int.Parse(pageIndex) : 1 })); }
public async Task <IActionResult> Delete(CategoryDeleteRequest request) { if (!ModelState.IsValid) { return(View()); } var result = await _categoryApiClient.Delete(request.Id); if (result == 1) { TempData["result"] = "Xóa danh mục thành công"; return(RedirectToAction("Index")); } ModelState.AddModelError("", "Xóa sản phẩm không thành công "); return(View(request)); }