Beispiel #1
0
        public async Task <IActionResult> Edit(BlogUpdateModel blogUpdateModel)
        {
            if (ModelState.IsValid)
            {
                await _blogApiService.UpdateAsync(blogUpdateModel);

                return(RedirectToAction("Index", "Blog"));
            }
            return(View(blogUpdateModel));
        }
Beispiel #2
0
        public async Task <IActionResult> Update(BlogUpdateModel model)
        {
            TempData["active"] = "blog";
            if (ModelState.IsValid)
            {
                await _blogApiService.UpdateAsync(model);

                return(RedirectToAction("Index"));
            }
            return(View(model));
        }
Beispiel #3
0
        public async Task <IActionResult> Edit(int id, BlogUpdateModel blogUpdateModel)
        {
            TempData["active"] = "blog";
            if (id != blogUpdateModel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                await _blogApiService.UpdateAsync(blogUpdateModel);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(blogUpdateModel));
        }