public HttpResponseMessage Put(FormDataCollection form) { Models.Factura factura = new Factura(); Models.DetalleServicio detalleservicio = new DetalleServicio(); factura.CodigoActividad1 = form.Get("CodActividad"); factura.Clave1 = form.Get("Clave"); factura.NumeroConsecutivo1 = form.Get("NumConsecutivo"); factura.FechaEmision1 = Convert.ToDateTime(form.Get("FechaEmision")); Identificacion idemisor = new Identificacion(); idemisor.Numero1 = form.Get("Emisor"); Persona emisor = new Persona(); emisor.IdentificacionNumero1 = idemisor; factura.EmisorPersona1 = emisor; Identificacion idreceptor = new Identificacion(); idreceptor.Numero1 = form.Get("Receptor"); Persona receptor = new Persona(); receptor.IdentificacionNumero1 = idreceptor; factura.ReceptorPersona1 = receptor; factura.CondicionVenta1 = form.Get("CondVenta"); factura.PlazoCredito1 = form.Get("PlazoCredito"); factura.MedioPago1 = form.Get("MedioPago"); var msgadevolver = factura.Insert_Factura(); DetalleServicio detalleservicio1 = new DetalleServicio(); detalleservicio1.Clave1 = factura; JArray jObject = JArray.Parse(form.Get("LineaDetalleFactura")); JToken jUser3 = jObject; var lista = jUser3.ToObject <List <lineadetalle_local> >(); List <LineaDetalle> listalineadetalleobj = new List <LineaDetalle>(); foreach (lineadetalle_local item in lista) { LineaDetalle lineadetalle = new LineaDetalle(); lineadetalle.Consecutivo1 = Convert.ToInt32(item.Consecutivo1); listalineadetalleobj.Add(lineadetalle); } detalleservicio1.LineaDetalleFactura1 = listalineadetalleobj; detalleservicio1.Insert_DetalleServicio(); string[] respuesta = new string[2]; respuesta[0] = msgadevolver; respuesta[1] = form.Get("Clave"); HttpResponseMessage response = Request.CreateResponse <string[]>(HttpStatusCode.Created, respuesta); return(response); }
public HttpResponseMessage Put(FormDataCollection form) { DetalleServicio detalleservicio = new DetalleServicio(); Factura clave = new Factura(); clave.Clave1 = form.Get("Clave"); detalleservicio.Clave1 = clave; string[] respuesta = new string[2]; respuesta[0] = detalleservicio.Insert_DetalleServicio(); respuesta[1] = form.Get("Clave"); HttpResponseMessage response = Request.CreateResponse <string[]>(HttpStatusCode.Created, respuesta); return(response); }