public HttpResponseMessage GetCheckShipmentsByMembership(int customerId) { try { BOShipments shipment = new BOShipments(); string result = shipment.checkShipmentsByMembership(customerId); Result json = JsonConvert.DeserializeObject <Result>(result); if (json.sendMail == "Yes") { BOContacts contact = new BOContacts(); var listContacts = new List <customer_contacts>(); listContacts = contact.GetContact(customerId); //List<Order> SortedList = objListOrder.OrderBy(o=>o.OrderDate).ToList(); var emailhandler = new TransShip.EMailHandler.EMailHandler(); emailhandler.SendMembershipEmail(json.message, listContacts[0].email); } return(Request.CreateResponse(HttpStatusCode.OK, result)); } catch (Exception e) { ErrorMessage mensaje = new ErrorMessage("2.1", "Exception to get shipments - " + e.GetBaseException().Message, e.ToString()); return(Request.CreateResponse(HttpStatusCode.InternalServerError, mensaje)); } }
public HttpResponseMessage Put(customer_contacts model) { try { BOContacts contact = new BOContacts(); customer_contacts cont; cont = contact.UpdateContact(model); return(Request.CreateResponse(HttpStatusCode.OK, cont)); } catch (Exception e) { ErrorMessage mensaje = new ErrorMessage("2.1", "Exception to update contacts - " + e.GetBaseException().Message, e.ToString()); return(Request.CreateResponse(HttpStatusCode.InternalServerError, mensaje)); } }
public HttpResponseMessage Delete(int idContact) { try { BOContacts contact = new BOContacts(); var delete = contact.DeleteContact(idContact); return(Request.CreateResponse(HttpStatusCode.OK, delete)); } catch (Exception e) { ErrorMessage mensaje = new ErrorMessage("2.1", "Exception to update contact - " + e.GetBaseException().Message, e.ToString()); return(Request.CreateResponse(HttpStatusCode.InternalServerError, mensaje)); } }
public HttpResponseMessage Get(int idCustomer) { try { BOContacts contact = new BOContacts(); var listContacts = new List <customer_contacts>(); listContacts = contact.GetContact(idCustomer); return(Request.CreateResponse(HttpStatusCode.OK, listContacts)); } catch (Exception e) { ErrorMessage mensaje = new ErrorMessage("2.1", "Exception to get contacts - " + e.GetBaseException().Message, e.ToString()); return(Request.CreateResponse(HttpStatusCode.InternalServerError, mensaje)); } }