public IActionResult Edit(InventarioMotoRequest oInventarioMotoRequest) { Response oResponse = new Response(); try { using (Italika_DBContext db = new Italika_DBContext()) { InventarioMoto oIngrediente = new InventarioMoto(); oIngrediente.Fert = oInventarioMotoRequest.Fert; oIngrediente.Modelo = oInventarioMotoRequest.Modelo; oIngrediente.Tipo = oInventarioMotoRequest.Tipo; oIngrediente.NumeroSerie = oInventarioMotoRequest.NumeroSerie; db.Entry(oIngrediente).State = Microsoft.EntityFrameworkCore.EntityState.Modified; db.SaveChanges(); oResponse.Success = true; } } catch (Exception ex) { oResponse.Message = ex.Message; } return(Ok(oResponse)); }
public IActionResult GetbyModelo(InventarioMotoRequest oInventarioMotoRequest) { Response oResponse = new Response(); try { using (Italika_DBContext db = new Italika_DBContext()) { var lst = from consulta in db.InventarioMotos.ToList() where consulta.Modelo == oInventarioMotoRequest.Modelo select new InventarioMotolst { Sku = consulta.Sku, Fert = consulta.Fert, Modelo = consulta.Modelo, Tipo = consulta.Tipo, NumeroSerie = consulta.NumeroSerie, Fecha = consulta.Fecha }; oResponse.Success = true; oResponse.Data = lst; } } catch (Exception ex) { oResponse.Message = ex.Message; } return(Ok(oResponse)); }
public IActionResult Add(InventarioMotoRequest oInventarioMotoRequest) { Response oResponse = new Response(); try { using (Italika_DBContext db = new Italika_DBContext()) { InventarioMoto oIngrediente = new InventarioMoto(); oIngrediente.Sku = oInventarioMotoRequest.Sku; oIngrediente.Fert = oInventarioMotoRequest.Fert; oIngrediente.Modelo = oInventarioMotoRequest.Modelo; oIngrediente.Tipo = oInventarioMotoRequest.Tipo; oIngrediente.NumeroSerie = oInventarioMotoRequest.NumeroSerie; oIngrediente.Fecha = DateTime.Today; db.Add(oIngrediente); db.SaveChanges(); oResponse.Success = true; } } catch (Exception ex) { oResponse.Message = ex.Message; } return(Ok(oResponse)); }