public IActionResult Create(SaveThuocDTO thuoc) { if (HttpContext.Session.GetString("Username") != null && HttpContext.Session.GetString("Role") == "3") { _service.Create(thuoc); return(RedirectToAction(nameof(Index))); } else { return(RedirectToAction("Index", "Account")); } }
public async Task <BaseResponse> Create(ThuocDTO thuocDto) { try { var result = _thuocService.Create(thuocDto); if (result) { return(await Task.FromResult(new BaseResponse(result))); } return(await Task.FromResult(new BaseResponse(Message.CreateNotSuccess))); } catch (Exception e) { return(await Task.FromResult(new BaseResponse(Message.CreateNotSuccess))); } }