public async Task <BaseResponse> Delete(string mathuoc) { try { var result = _thuocService.Delete(mathuoc); if (result) { return(await Task.FromResult(new BaseResponse(result))); } return(await Task.FromResult(new BaseResponse(Message.DeleteNotSuccess))); } catch (Exception) { return(await Task.FromResult(new BaseResponse(Message.DeleteNotSuccess))); } }
public IActionResult DeleteConfirm(int?id) { if (HttpContext.Session.GetString("Username") != null && HttpContext.Session.GetString("Role") == "3") { if (id == null) { return(NotFound()); } _service.Delete(id.Value); return(RedirectToAction(nameof(Index))); } else { return(RedirectToAction("Index", "Account")); } }