public async Task <IActionResult> Create([Bind("Name,Description")] BeerStyleViewModel beerStyle) { if (ModelState.IsValid) { var beerStyleDTO = beerStyle.MapViewToDTO(); await this._service.CreateAsync(beerStyleDTO); return(RedirectToAction(nameof(Index))); } return(View(beerStyle)); }
public async Task <IActionResult> Edit(int?id, [Bind("ID,Name,Description")] BeerStyleViewModel beerStyle) { if (id != beerStyle.ID) { return(NotFound()); } var returnModel = await this._service.UpdateAsync(id, beerStyle.MapViewToDTO()); if (returnModel == null) { return(NotFound()); } return(View(returnModel.MapDTOToView())); }