public async Task <TResponse <bool> > AddUser(InsertRoleUserModel model) { try { var response = await HttpService.Send <bool>(_baseUrl + ApiUrl.ROLE_ADD_USER, model, HttpMethod.Post); if (response.IsSuccess) { return(await Ok(response.Data)); } return(await Fail <bool>(response.Message)); } catch (Exception exception) { return(await Fail <bool>(exception)); } }
public async Task <IActionResult> AddRole(InsertRoleUserModel model) { if (ModelState.IsValid) { var result = await _roleService.AddUser(model); if (result.IsSuccess) { StatusMessage = SuccessNotifcation("Insert role success!"); return(RedirectToAction("Role", "User", new { id = model.UserId })); } ModelState.AddModelError("", result.Message); } ViewBag.Roles = await _roleService.GetWithoutUserId(model.UserId); return(View(model)); }