public override Bill Update(Bill entity) { var entityInDb = RepositoryDbSet .Include(c => c.Payments) .Include(c => c.WorkObject) .Include(m => m.Comment) .ThenInclude(t => t.Translations) .FirstOrDefault(x => x.Id == entity.Id); entityInDb.Comment.SetTranslation(entity.Comment); return(entity); }
public static internalDTO.Bill MapFromDAL(externalDTO.Bill bill) { var res = bill == null ? null : new internalDTO.Bill { Id = bill.Id, ClientId = bill.ClientId, Client = ClientMapper.MapFromDAL(bill.Client), WorkObjectId = bill.WorkObjectId, WorkObject = WorkObjectMapper.MapFromDAL(bill.WorkObject), ArrivalFee = bill.ArrivalFee, SumWithOutTaxes = bill.SumWithoutTaxes, TaxPercent = bill.TaxPercent, FinalSum = bill.FinalSum, DateTime = bill.DateTime, InvoiceNr = bill.InvoiceNr, Comment = new internalDTO.MultiLangString(bill.Comment), // BillLines = bill.BillLines.Select(e => BillLineMapper.MapFromDAL(e)).ToList(), // Payments = bill.Payments.Select(e => PaymentMapper.MapFromDAL(e)).ToList(), }; return(res); }