public HttpResponseMessage Post(string id, LoyaltyCardTransaction model) { try { if (model != null) { FamiHub.Models.Customers.Customer customer = FamiHub.BusinessLayer.Loyalty.Card.GetCustomerByCardNumber(id); FamiHub.Models.Customers.LoyaltyPartner partner = FamiHub.BusinessLayer.Loyalty.Card.GetLoyaltyPartnerById(model.PartnerId); if (customer != null && partner != null) { FamiHub.BusinessLayer.Loyalty.Transactions.AddPoints(customer, partner, model.Points, model.Comments); var _result = new ViewModels.LoyaltyCardBalance { CardNumber = id, Balance = Generic.CheckBalance(customer) }; return(Request.CreateResponse(HttpStatusCode.OK, _result)); } else { return(Request.CreateResponse(HttpStatusCode.NotFound)); } } return(Request.CreateResponse(HttpStatusCode.NotFound)); } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex)); } }
public HttpResponseMessage Post(FamiHub.Models.Customers.Customer model) { try { FamiHub.Models.Customers.Customer customer = FamiHub.BusinessLayer.Customers.Crud.Put(model); return(Request.CreateResponse(HttpStatusCode.OK, customer)); } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex)); } }
public HttpResponseMessage Get(Guid id) { FamiHub.Models.Customers.Customer customer = FamiHub.Crud.GetById <FamiHub.Models.Customers.Customer, Guid>(id); if (customer != null) { return(Request.CreateResponse(HttpStatusCode.OK, customer)); } else { return(Request.CreateResponse(HttpStatusCode.NotFound)); } }
public HttpResponseMessage Get(string id) { FamiHub.Models.Customers.Customer customer = FamiHub.BusinessLayer.Loyalty.Card.GetCustomerByCardNumber(id); IEnumerable <FamiHub.Models.Customers.LoyaltyTransaction> _transList = FamiHub.BusinessLayer.Loyalty.Transactions.GetAllTransactions(customer); if (_transList != null && _transList.Count() > 0) { return(Request.CreateResponse(HttpStatusCode.OK, _transList)); } else { return(Request.CreateResponse(HttpStatusCode.NotFound)); } }
public HttpResponseMessage Get(string id) { try { FamiHub.Models.Customers.Customer customer = FamiHub.BusinessLayer.Loyalty.Card.GetCustomerByCardNumber(id); if (customer != null) { var _result = new ViewModels.LoyaltyCardBalance { CardNumber = id, Balance = Generic.CheckBalance(customer) }; return(Request.CreateResponse(HttpStatusCode.OK, _result)); } else { return(Request.CreateResponse(HttpStatusCode.NotFound)); } } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex)); } }
public static long CheckBalance(FamiHub.Models.Customers.Customer customer) { return(FamiHub.BusinessLayer.Loyalty.Transactions.CheckBalance(customer)); }