Пример #1
0
        public IActionResult Update(long id)
        {
            Chef chef = this._chefService.GetById(id);
            UpdateChefViewModel model = this._mapper.Map <UpdateChefViewModel>(chef);

            return(View(model));
        }
Пример #2
0
        public async Task <ActionResult> Update(long id, UpdateChefViewModel chefViewModel)
        {
            if (ModelState.IsValid)
            {
                if (chefViewModel.Image != null)
                {
                    await this._imgurService.EditImage(chefViewModel);
                }

                this._chefService.UpdateById(id, this._mapper.Map <Chef>(chefViewModel));

                return(RedirectToAction("Index", "Home"));
            }

            chefViewModel.Id = id;

            return(View(chefViewModel));
        }