public MobileAppCustomer MobileAppCustomerDetails(Guid id) { MobileAppCustomer customer = new MobileAppCustomer(); //TODO REPLACE * WITH COLUMNS string query = "select * from tbl_Customer c " + " left join tbl_users u on ltrim(rtrim(c.CustomerNo)) = ltrim(rtrim(u.SaccoMembershipNumber)) " + " left join tbl_TellerAccounts ta on ta.LoginCode = u.LoginCode " + " where c.tbl_CustomerID = '" + id.ToString() + "'"; if (!string.IsNullOrWhiteSpace(id.ToString())) { customer = mainDb.Database.SqlQuery <MobileAppCustomer>(query).FirstOrDefault(); if (customer != null) { if (!string.IsNullOrWhiteSpace(customer.LoginCode) && !string.IsNullOrWhiteSpace(customer.TellerAccountNo)) { customer.IsTeller = true; } } } return(customer); }
public HttpResponseMessage GetCustomer(Guid id) { MobileAppCustomer customer = customerAccountsManager.MobileAppCustomerDetails(id); if (customer == null) { String notFoundMessage = "Member number not found"; HttpError err = new HttpError(notFoundMessage); return(Request.CreateResponse(HttpStatusCode.NotFound, err)); } return(Request.CreateResponse(HttpStatusCode.OK, customer)); }