Пример #1
0
        internal async Task <bool> CreateRenter(RenterCreateModel renterCreateModel)
        {
            Renter renter = CreateRenterObjectFromRenterCreateModel(renterCreateModel);

            this.renterRepository.AddRenter(renter);
            return(await this.renterRepository.SaveChangesAsync());
        }
Пример #2
0
 private static Renter CreateRenterObjectFromRenterCreateModel(RenterCreateModel renterCreateModel)
 {
     return(new Renter
     {
         Name = renterCreateModel.Name,
         Address = renterCreateModel.Address,
         ContactNumber = renterCreateModel.Address,
         Description = renterCreateModel.Description,
         SeekedAsset = renterCreateModel.SeekedAsset,
     });
 }
Пример #3
0
        public async Task <IActionResult> Create(RenterCreateModel renterCreateModel)
        {
            if (this.ModelState.IsValid)
            {
                var result = await renterService.CreateRenter(renterCreateModel);

                return(RedirectToAction("Index"));
            }
            else
            {
                return(RedirectToAction("Create"));
            }
        }