/// <summary> /// Update transaction. /// </summary> /// <param name="model">Updated transaction information</param> public async Task UpdateDataModelAsync(TransactionBatch model) { var currentModel = await db.TransactionBatch.FirstOrDefaultAsync(i => i.Id == model.Id); db.Entry(currentModel).CurrentValues.SetValues(model); await db.SaveChangesAsync(); }
/// <summary> /// Update facility. /// </summary> /// <param name="model">Updated facility information</param> public async Task UpdateDataModelAsync(Facility model) { var currentModel = await db.Facility.FirstOrDefaultAsync(i => i.Id == model.Id); db.Entry(currentModel).CurrentValues.SetValues(model); await db.SaveChangesAsync(); }
/// <summary> /// Update product recipe relation. /// </summary> /// <param name="model">Updated product recipe relation information</param> public async Task UpdateDataModelAsync(RecipeProductChanges model) { var currentModel = await db.RecipeProductChanges.FirstOrDefaultAsync(i => i.RecipeId == model.RecipeId && i.ProductId == model.ProductId); db.Entry(currentModel).CurrentValues.SetValues(model); await db.SaveChangesAsync(); }
/// <summary> /// Update tech process. /// </summary> /// <param name="model">Updated company information</param> public async Task UpdateDataModelAsync(TechProcess model) { var currentModel = await db.TechProcess.FirstOrDefaultAsync(i => i.RecipeId == model.RecipeId && i.FacilityId == model.FacilityId); db.Entry(currentModel).CurrentValues.SetValues(model); await db.SaveChangesAsync(); }