public async Task <IActionResult> Edit(int id, EditCauseInputModel input) { if (!this.ModelState.IsValid) { return(this.View(input)); } await this.causesService.UpdateAsync(id, input); return(this.RedirectToAction(nameof(this.ViewCauseInfo), new { id })); }
public async Task UpdateAsync(int id, EditCauseInputModel input) { var cause = this.causesRepo.All().FirstOrDefault(x => x.Id == id); cause.Title = input.Title; cause.Description = input.Description; cause.Funds = input.Funds; cause.BankAccount = input.BankAccount; cause.AccountOwner = input.AccountOwner; cause.StartOfPeriod = input.StartOfPeriod; cause.EndOfPeriod = input.EndOfPeriod; await this.causesRepo.SaveChangesAsync(); }