public string PayReservation(int userId, decimal amountPayed, DateTime datePaied) { using (var uow = UnitOfWorkProvider.Create()) { var reservation = RoomReservationRepository.GetById(userId); var user = UserRepository.GetById(userId); if (user == null) { throw new UIException("Neexistuje užívateľ korého registráciu sa snažíte zaplatiť"); } if (reservation == null) { reservation = new RoomReservation { Id = userId, AmountPayed = amountPayed, DatePaid = datePaied, Note = string.Empty }; RoomReservationRepository.Insert(reservation); } else { reservation.AmountPayed = amountPayed; reservation.DatePaid = datePaied; } uow.Commit(); return(user.UserName); } }