public async Task EditNewsAsync(EditNewsInputModel input, int id) { var news = this.newsRepository.All().FirstOrDefault(x => x.Id == id); news.Name = input.Name; news.Description = input.Description; news.NewsDate = input.NewsDate; await this.newsRepository.SaveChangesAsync(); }
public async Task <IActionResult> EditNews(EditNewsInputModel input, int id) { if (!this.ModelState.IsValid) { return(this.View()); } await this.newsService.EditNewsAsync(input, id); return(this.RedirectToAction(nameof(this.Success))); }