public RestAPIAddRoleResponse InsertRole(ResponseBase response, string RoleName) { Role role; RestAPIAddRoleResponse restAPIAddRoleResponse = new RestAPIAddRoleResponse(); DatabaseWrapper.databaseOperation(response, (context, query) => { bool isValid = query.GetRoleByName(context, RoleName); if (!isValid) { role = new Role() { RoleName = RoleName, CreatedDate = DateTime.UtcNow, IsActive = true }; query.AddRole(context, role); response.Status = Enum.GetName(typeof(ResponseStatusType), ResponseStatusType.Success); } else { response.Status = Enum.GetName(typeof(ResponseStatusType), ResponseStatusType.Failure); response.ErrorList.Add(Faults.RoleNameExists); return; } context.SubmitChanges(); } , readOnly: false ); return(restAPIAddRoleResponse); }
public RestAPIAddRoleResponse AddRoleToUser(RestAPIAddRoleRequest req) { RestAPIAddRoleResponse response = new RestAPIAddRoleResponse(); roleUtils.InsertRoleMapping(response, UserID, req.RoleId); return(response); }
public RestAPIAddRoleResponse AddRole(RestAPIAddRolesRequest req) { RestAPIAddRoleResponse response = new RestAPIAddRoleResponse(); roleUtils.InsertRole(response, req.RoleName); return(response); }