Ejemplo n.º 1
0
        public void Update(int id, CreateFeesInputModel inputModel)
        {
            var fee = this.repository.All().Where(x => x.Id == id).FirstOrDefault();

            fee.Name        = inputModel.Name;
            fee.Price       = inputModel.Price;
            fee.Description = inputModel.Description;
            this.repository.Update(fee);
            this.repository.SaveChangesAsync().GetAwaiter().GetResult();
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create(CreateFeesInputModel inputModel)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.View(inputModel.RealEstateId));
            }

            await this.feesService.CreateAsync(inputModel);

            return(this.Redirect($"/Fees/All?realEstateId={inputModel.RealEstateId}"));
        }
Ejemplo n.º 3
0
        public IActionResult Update(int id, CreateFeesInputModel inputModel)
        {
            this.ViewBag.realEstateId = inputModel.RealEstateId;
            if (!this.ModelState.IsValid)
            {
                var model = this.feesService.Get(id);
                return(this.View(model));
            }

            this.feesService.Update(id, inputModel);
            return(this.Redirect($"/Fees/All?realEstateId={inputModel.RealEstateId}"));
        }
Ejemplo n.º 4
0
        public async Task CreateAsync(CreateFeesInputModel inputModel)
        {
            var fee = new Fee()
            {
                Name         = inputModel.Name,
                Price        = inputModel.Price,
                Description  = inputModel.Description,
                RealEstateId = inputModel.RealEstateId,
            };

            await this.repository.AddAsync(fee);

            await this.repository.SaveChangesAsync();
        }