public async Task <bool> MapGlueIngredient(GlueIngredient glueIngredient) { if (glueIngredient.Position.IsNullOrEmpty()) { return(false); } var item = await _repoGlueIngredient.FindAll().FirstOrDefaultAsync(x => x.GlueID == glueIngredient.GlueID && x.IngredientID == glueIngredient.IngredientID); if (item == null) { _repoGlueIngredient.Add(glueIngredient); return(await _repoGlueIngredient.SaveAll()); } else { item.Percentage = glueIngredient.Percentage; item.Allow = glueIngredient.Allow; item.Position = glueIngredient.Position; return(await _repoGlueIngredient.SaveAll()); } }
public async Task <bool> MapGlueIngredient(GlueIngredient glueIngredient) { _repoGlueIngredient.Add(glueIngredient); return(await _repoGlueIngredient.SaveAll()); }