public async Task UpdateAsync(int id, EditEventInputModel input)
        {
            var eventModel = this.eventRepository.All().FirstOrDefault(x => x.Id == id);

            eventModel.Title       = input.Title;
            eventModel.Name        = input.Name;
            eventModel.Date        = input.Date;
            eventModel.Place       = input.Place;
            eventModel.Description = input.Description;
            await this.eventRepository.SaveChangesAsync();
        }
Esempio n. 2
0
        public IActionResult Edit(EditEventInputModel input, string id)
        {
            if (!ModelState.IsValid)
            {
                return(this.View(input));
            }

            this.eventService.EditEvent(input.Description, input.Address, input.ImageUrl, id);

            return(this.RedirectToAction("Details", new { id = id }));
        }
        public async Task <IActionResult> Edit(int id, EditEventInputModel input)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.View(input));
            }

            await this.eventsService.UpdateAsync(id, input);

            return(this.RedirectToAction(nameof(this.Details), new { id }));
        }