public DepositDetVm ViewDepositById(int id) { var deposit = _depositRepository.GetDepositById(id); var owner = _ownerRepository.GetOwner(deposit.OwnerId); var season = _depositRepository.GetSeason(deposit.SeasonTireId); var contact = _ownerRepository.GetContact(owner.Id); var depositVm = new DepositDetVm(); { depositVm.Id = deposit.Id; depositVm.Name = deposit.Name; depositVm.TireTreadHeight = deposit.TireTreadHeight; depositVm.SeasonTire = season.Name; depositVm.OwnerFullName = owner.LastName + " " + owner.FirstName; depositVm.OwnerEmail = contact.Email; depositVm.OwnerTel = contact.Tel; depositVm.StartDate = deposit.StartDate.Date.ToString("d"); if (deposit.EndDate != null) { depositVm.EndDate = deposit.EndDate.Value.ToString("d"); } ; if (deposit.Price != null) { depositVm.Price = deposit.Price.Value; } ; } return(depositVm); }