public async Task <IActionResult> AddPaperType(PaperTypeViewModel model) { if (!ModelState.IsValid) { return(View(model)); } await this.materials.AddPaperTypeAsync( model.Name, model.Grammage, model.IsActive); return(RedirectToAction(nameof(AllPaperTypes))); }
public async Task <IActionResult> EditPaperType(int id, PaperTypeViewModel model) { if (!ModelState.IsValid) { return(View(model)); } var success = await this.materials.EditPaperTypeAsync( id, model.Name, model.Grammage, model.IsActive); if (!success) { return(NotFound()); } return(RedirectToAction(nameof(AllPaperTypes))); }