public async Task <bool> UpdateAsync(InkUpdateDto model) { var ink = _mapper.Map <Ink>(model); _repoInk.Update(ink); return(await _repoInk.SaveAll()); }
public async Task <object> UpdatePart(PartInkChemicalDto obj) { try { var part = _repoPart.FindById(obj.partID); part.Name = obj.name; _repoPart.Update(part); foreach (var item in obj.listAdd) { if (item.subname == "Ink") { var ink = _repoInk.FindById(item.ID); ink.percentage = item.percentage; _repoInk.Update(ink); await _repoInk.SaveAll(); } else { var chemical = _repoChemical.FindById(item.ID); chemical.Percentage = item.percentage; _repoChemical.Update(chemical); await _repoChemical.SaveAll(); } } // var message = "success"; return(new { data = await _repoPart.SaveAll(), status = true, message = "success" }); } catch (System.Exception ex) { return(new { status = false, message = "save to error" }); } }