public IHttpActionResult Register(RestoAdminRegisterModel RegisterModel) { RegisterReturn xReturn = new RegisterReturn(); if (RegisterModel != null) { using (var ctx = new RestoAdminEntity()) { string passwordHash = BCrypt.Net.BCrypt.HashPassword(RegisterModel.Password); int xVal = ctx.sp_ra_registerUser(RegisterModel.Username, passwordHash, RegisterModel.RoleId, RegisterModel.FirstName, RegisterModel.MiddleName, RegisterModel.LastName, "System"); if (xVal == 0) { xReturn.ResponseCode = "200"; xReturn.ResponseDescription = "Success"; } else { xReturn.ResponseCode = "500"; xReturn.ResponseDescription = "Unknown Error"; } } } else { xReturn.ResponseCode = "500"; xReturn.ResponseDescription = "Unknown Error"; } return(Ok(new { xReturn })); }
public IHttpActionResult GetRoles() { RolesReturn xReturn = new RolesReturn(); List <RolesModel> RoleObject = new List <RolesModel>(); using (var ctx = new RestoAdminEntity()) { var roles = ctx.sp_ra_getRoles(); foreach (var role in roles) { RolesModel rm = new RolesModel(); rm.RoleId = role.id.ToString(); rm.RoleName = role.roleValue; RoleObject.Add(rm); } } xReturn.Role = RoleObject; return(Ok(new { xReturn })); }