internal async Task <bool> CreateRenter(RenterCreateModel renterCreateModel) { Renter renter = CreateRenterObjectFromRenterCreateModel(renterCreateModel); this.renterRepository.AddRenter(renter); return(await this.renterRepository.SaveChangesAsync()); }
private static Renter CreateRenterObjectFromRenterCreateModel(RenterCreateModel renterCreateModel) { return(new Renter { Name = renterCreateModel.Name, Address = renterCreateModel.Address, ContactNumber = renterCreateModel.Address, Description = renterCreateModel.Description, SeekedAsset = renterCreateModel.SeekedAsset, }); }
public async Task <IActionResult> Create(RenterCreateModel renterCreateModel) { if (this.ModelState.IsValid) { var result = await renterService.CreateRenter(renterCreateModel); return(RedirectToAction("Index")); } else { return(RedirectToAction("Create")); } }