Ejemplo n.º 1
0
 public IActionResult Post()
 {
     try
     {
         if (!ModelState.IsValid)
         {
             return(BadRequest(ModelState));
         }
         LoteDto lote = new LoteDto();
         lote.Imagen        = Request.Form.Files[0];
         lote.Nombre        = Request.Form["nombre"];
         lote.Descripcion   = Request.Form["descripcion"];
         lote.ClienteId     = Request.Form["clienteId"];
         lote.MunicipioId   = Convert.ToInt32(Request.Form["municipioId"]);
         lote.PrecioBase    = Convert.ToDecimal(Request.Form["precioBase"]);
         lote.SubastaId     = Convert.ToInt32(Request.Form["subastaId"]);
         lote.ValorAnticipo = Convert.ToDecimal(Request.Form["valorAnticipo"]);
         loteService.Add(lote);
         return(Ok(lote));
     }
     catch (Exception)
     {
         throw;
     }
 }