Ejemplo n.º 1
0
 public static Inventario voToObject(InventarioVo vo)
 {
     return(new Inventario
     {
         id = vo.id,
         producto = new Producto {
             id = vo.producto_id
         },
         cantidad = vo.cantidad,
         turno = vo.turno
     });
 }
Ejemplo n.º 2
0
        public HttpResponseMessage create([FromBody] InventarioVo inventario_vo)
        {
            TransactionResult            tr   = inventario_service.create(inventario_vo);
            IDictionary <string, string> data = new Dictionary <string, string>();

            if (tr == TransactionResult.CREATED)
            {
                data.Add("message", "Object created.");
                return(Request.CreateResponse(HttpStatusCode.Created, data));
            }
            else if (tr == TransactionResult.EXISTS)
            {
                data.Add("message", "Object already existed.");
                return(Request.CreateResponse(HttpStatusCode.Conflict, data));
            }
            else
            {
                data.Add("message", "There was an error attending your request.");
                return(Request.CreateResponse(HttpStatusCode.BadRequest, data));
            }
        }
Ejemplo n.º 3
0
        public TransactionResult create(InventarioVo inventario_vo)
        {
            Inventario obj = InventarioAdapter.voToObject(inventario_vo);

            return(inventario_repository.create(obj));
        }