public IHttpActionResult GetCreate_orderLine(string _IdO) { int _ido = int.Parse(_IdO); OrderSet order = db.OrderSet.Find(_ido); GenericImplement <OrderLineSet> _GenericMethod = new GenericImplement <OrderLineSet>(); if (order == null) { return(NotFound()); } OrderLineSet _OrderLine = new OrderLineSet(); _GenericMethod.Insert(_OrderLine); System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(_OrderLine.GetType()); var _StringWriter = new StringWriter(); XmlWriter _Writer = XmlWriter.Create(_StringWriter); x.Serialize(_Writer, _OrderLine); string _Xml = _StringWriter.ToString(); return(Ok(_Xml)); }
public IHttpActionResult Post(Product P) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } GenericImplement <Product> _products = new GenericImplement <Product>(); _products.Insert(P); return(CreatedAtRoute("DefaultApi", new { id = P.IdProduct }, _products)); }
public IHttpActionResult GetCreateOrder(string IdC) { int id = int.Parse(IdC); Customer custumer = db.Customer.Find(id); GenericImplement <OrderSet> _GenericMethod = new GenericImplement <OrderSet>(); if (custumer == null) { return(NotFound()); } OrderSet order = new OrderSet(); _GenericMethod.Insert(order); return(Ok(order)); }
public bool Invoice(OrderSet order) { try { InvoiceSet _invoice = new InvoiceSet(); GenericImplement <InvoiceSet> _GenericImplement = new GenericImplement <InvoiceSet>(); _invoice.OrderSet = db.OrderSet.Find(order.IdOrder); _invoice.InvoiceNumber = db.InvoiceSet.Count() + 1; _invoice.InvoiceDate = DateTime.Now; _invoice.HTAmount = order.HTAmount; _invoice.TTCAmount = order.TTCAmount; _invoice.TotalOfLines = (short)_invoice.InvoiceLineSet.Count(); _invoice.Order_Id = order.IdOrder; _GenericImplement.Insert(_invoice); return(true); } catch (Exception) { return(false); } }
public IHttpActionResult GetCreateOrder(string _IdC) { int _id = int.Parse(_IdC); Customer custumer = db.Customer.Find(_id); GenericImplement <OrderSet> _GenericMethod = new GenericImplement <OrderSet>(); if (custumer == null) { return(NotFound()); } OrderSet _Order = new OrderSet(); _GenericMethod.Insert(_Order); System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(_Order.GetType()); var _StringWriter = new StringWriter(); XmlWriter _Writer = XmlWriter.Create(_StringWriter); x.Serialize(_Writer, _Order); string _Xml = _StringWriter.ToString(); return(Ok(_Xml)); }