public async Task CrearLacteo([Service] IngredientesRepository repo, [Service] ITopicEventSender eventSender, int idLacteo, String nombre, bool alergeno) { Lacteo newLacteo = await repo.CrearLacteoAsync(idLacteo, nombre, alergeno); await eventSender.SendAsync("Guardado Lacteo", newLacteo); }
public async Task <Lacteo> LacteoById([Service] IngredientesRepository repo, [Service] ITopicEventSender eventSender, int id) { Lacteo lacteoId = repo.GetLacteoId(id); await eventSender.SendAsync("RetornaLacteo", lacteoId); return(lacteoId); }
public async Task <Lacteo> ModificarLacteoAsync(int idLacteo, String nombre, bool alergeno) { Lacteo lacteo = GetLacteoId(idLacteo); lacteo.NombreLacteo = nombre; lacteo.AlergenoLacteo = alergeno; await this._dbContext.SaveChangesAsync(); return(lacteo); }
public async Task <Lacteo> CrearLacteoAsync(int id, String nombre, bool alergeno) { Lacteo lacteo = new Lacteo(); lacteo.Id = id; lacteo.NombreLacteo = nombre; lacteo.AlergenoLacteo = alergeno; this._dbContext.Lacteos.Add(lacteo); await this._dbContext.SaveChangesAsync(); return(lacteo); }