/// <summary> /// Adds a Role /// Level: Logic /// </summary> /// <param name="Role">The Role</param> /// <returns>True if Successful, False if Not</returns> public bool AddRole(string Role) { try { RolesRepository myRepository = new RolesRepository(); if (!myRepository.RoleExists(Role)) { Common.Role myRole = new Role(); myRole.Role1 = Role; myRepository.AddRole(myRole); return(true); } else { return(false); } } catch (Exception Exception) { throw Exception; } }
public IActionResult Add([FromBody] Role roleToAdd) { if (!ModelState.IsValid) { return(BadRequest()); } _rolesRepository.AddRole(roleToAdd); return(Accepted(roleToAdd)); }