Ejemplo n.º 1
0
        public static Rent ViewModelToModel(RentViewModel rentVM, Rent rent)
        {
            rent.Id         = rentVM.Id;
            rent.CustomerId = rentVM.CustomerId;
            rent.Customer   = rentVM.Customer;
            rent.VehicleId  = rentVM.VehicleId;
            rent.Vehicle    = rentVM.Vehicle;
            rent.PickupDate = rentVM.PickupDate;
            rent.ReturnDate = rentVM.ReturnDate;
            rent.TypeOfRent = rentVM.TypeOfRentEnum;
            rent.Daily      = rentVM.Daily;
            rent.Location   = rentVM.Location;

            return(rent);
        }
Ejemplo n.º 2
0
        public static RentViewModel ModelToViewModel(Rent rent)
        {
            RentViewModel rentVM = new RentViewModel()
            {
                Id             = rent.Id,
                CustomerId     = rent.CustomerId,
                Customer       = rent.Customer,
                VehicleId      = rent.VehicleId,
                Vehicle        = rent.Vehicle,
                PickupDate     = rent.PickupDate,
                ReturnDate     = rent.ReturnDate,
                TypeOfRent     = rent.TypeOfRent.ObterDescricao(),
                TypeOfRentEnum = rent.TypeOfRent,
                Daily          = rent.Daily,
                Location       = rent.Location
            };

            return(rentVM);
        }