protected IHttpActionResult GetErrorResult(BaseWorkflow workflow) { if (workflow == null) { return InternalServerError(); } if (!workflow.Succeed) { if (workflow.Errors != null) { foreach (string error in workflow.Errors) { ModelState.AddModelError("Errors", error); } } if (ModelState.IsValid) { return BadRequest(); } return BadRequest(ModelState); } return null; }
public NewUserResponse Create(BaseWorkflow workflow) { var user = workflow.Result as User; return new NewUserResponse() { Domain = user.Domain.Name, Guid = user.Guid, Id = user.Id, Login = user.Login, Password = workflow.Data["password"], Name = user.Name, Mail = user.Email, DisplayName = user.DisplayName, Description = user.Description, Info = user.Info, LdapSid = user.LdapSid, Errors = workflow.Errors.Count > 0 ? workflow.Errors : null }; }