public List <TreatmentRatioTotalViewPar> GetAll() { using (var ingredient = new TreatmentRatioTotalRepository()) { return(ingredient.GetAll().Select(x => new TreatmentRatioTotalViewPar { TreatmentRatioTotalId = x.TreatmentRatioTotalId, Price = x.Price, TreatmentName = _treatment.GetAll().ToList().Find(y => y.Tid == x.Tid).Tname }).ToList()); } }
public void Add(TreatmentRatioTotalView model) { using (var ratio = new TreatmentRatioTotalRepository()) { List <TreatmentRatio> total = _ratio.GetAll().ToList().FindAll(x => x.Tid == model.Tid); var treat = new TreatmentRatioTotal { TreatmentRatioTotalId = model.TreatmentRatioTotalId, Price = total.Sum(x => x.TreatPrice), Tid = model.Tid }; ratio.Insert(treat); } }