public RoleView CreateRole([FromBody] RoleView model) { Role role = mapper.Map <RoleView, Role>(model); role = roleRep.CreateRole(role); RoleView a = mapper.Map <Role, RoleView>(role); return(a); }
public async Task <IActionResult> Create(ApplicationRole role) { var createRole = await _role.CreateRole(role); if (createRole) { return(RedirectToAction("Index")); } return(View()); }
public ActionResult Create([FromForm] roleViewModel model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var serializeRole = RoleMapper.SerializeRole(model); var newRole = _role.CreateRole(serializeRole); return(Ok(newRole)); }
public async Task <IActionResult> Create(RoleDto registerRole) { ApplicationRole r = new ApplicationRole(); r.Name = registerRole.RoleName; var newRole = await _role.CreateRole(r); if (newRole) { return(RedirectToAction("Index")); } return(View()); }
public async Task <IActionResult> Post([FromBody] RoleDto registerRole) { ApplicationRole r = new ApplicationRole(); r.RoleName = registerRole.RoleName; var newRole = await _role.CreateRole(r); if (newRole) { return(Ok(new { message = "Role Created" })); } return(BadRequest(new { message = "Role not created" })); }
public IPeople CreateUser(int userId, string emailId, string firstName, string middleName, string lastName, int siteId, string siteUserId, List <IRole> roles, string password, List <IImage> userImages) { return(new People() { UserId = userId, EmailId = emailId, FirstName = firstName, MiddleName = middleName, LastName = lastName, Password = password, SiteId = siteId, SiteUserId = siteUserId, UserRoles = (from r in roles select _roleDomain.CreateRole(r.RoleId, r.RoleCode)).ToList(), UserImages = (from i in userImages select _imageDomain.CreateImage(i.ImageId, i.UserImage)).ToList() }); }