Exemple #1
0
        public async Task <IActionResult> Edit(TagView result)
        {
            var tag = await _tagService.Get(result.Id);

            if (tag.Name != result.Name)
            {
                if (await _tagService.CheckIfTagExist(result.Name))
                {
                    ModelState.AddModelError("", "Tag o tej nazwie już istnieje");
                }
            }

            if (!ModelState.IsValid)
            {
                return(View(result));
            }


            await _tagService.Update(TagHelpers.MergeViewWithModel(tag, result));

            return(RedirectToAction("List"));
        }