public async Task <IActionResult> Update(IFormCollection collection)
        {
            var model = new ExpenseUpdateItemViewModel();

            if (await this.TryUpdateModelAsync(model))
            {
                try
                {
                    if (await this.employeeFacade.UpdateExpenseAsync(model))
                    {
                        return(this.RedirectToAction(nameof(this.Index)));
                    }
                    else
                    {
                        return(this.NotFound());
                    }
                }
                catch (ArgumentException ex)
                {
                    this.ModelState.AddModelError(ex.ParamName, ex.Message);
                }
            }
            return(this.View(model));
        }
Exemple #2
0
 public async Task <bool> UpdateExpenseAsync(ExpenseUpdateItemViewModel model)
 {
     return(await this.expenseService.UpdateExpenseAsync(Mapper.Map <ExpenseUpdateDomainModel>(model)));
 }