public IHttpActionResult GetRegistrations([FromUri] RegistrationsParametersGetAll registrationsParametersGetAll) { IList <RegistrationsDTO> registrationsDTO = _registrationsservice.GetRegistrations(registrationsParametersGetAll, out ReturnValues returnValues); if (!returnValues.Error) { return(Ok(new ResponseSuccess { Success = true, Status = Convert.ToInt32(returnValues.Code), Message = returnValues.Message, Data = new { Registrations = registrationsDTO } })); } return(Ok(new ResponseError { Success = false, Status = Convert.ToInt32(returnValues.Code), Message = returnValues.Message })); }
public IList <RegistrationsDTO> GetRegistrations(RegistrationsParametersGetAll registrationsParametersGetAll, out ReturnValues returnValues) { IList <RegistrationsDTO> registrationsDTO = null; returnValues = new ReturnValues(); try { var query = _unitOfWork.RegistrationRepository.QueryableObject(); registrationsDTO = query.Select(row => new RegistrationsDTO() { ID = row.ID.ToString(), Status = row.Status.ToString(), Name = row.Name, Email = row.Email, CPFCNPJ = row.CPFCNPJ, Phone = row.Phone, Username = row.Username, Password = row.Password, CEP = row.CEP, Address = row.Address, Number = row.Number, DistrictID = row.DistrictID, CityID = row.CityID, StateID = row.StateID, Type = row.Type, CreatedOn = row.CreatedOn.ToString(), UpdatedOn = row.UpdatedOn.ToString() }).ToList(); returnValues.SetReturnValues(false, ErrorCodes.Ok, Utils.GetEnumDescription(ErrorCodes.Ok)); } catch (Exception ex) { returnValues.SetReturnValues(true, ErrorCodes.InternalError, ex.Message); } return(registrationsDTO as IList <RegistrationsDTO>); }