public SettlementDTOPut EditSettlement(SettlementDTOPut settlementDto, int id) { var edited = Mapper.Map <Settlement>(settlementDto); var original = settlementRepository.Query().AsNoTracking().FirstOrDefault(s => s.Id == id && s.Id == edited.Id); if (original == null) { return(null); } settlementRepository.Update(edited); settlementRepository.Commit(); return(Mapper.Map <SettlementDTOPut>(edited)); }