Exemplo n.º 1
0
        public async Task <IActionResult> Create(TagPostViewModel tagPost)
        {
            try
            {
                var user = await _userManager.GetUserAsync(User);

                _ = await _TagsService.CreateTagUsuario(user.Id, tagPost.Tag);
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("Tag", ex.Message);
                return(View("Create"));
            }
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> UpdateTag(long id, TagPostViewModel tagPut)
        {
            try
            {
                var user = await _userManager.GetUserAsync(User);

                _ = await _TagsService.UpdateTagUsuario(user.Id, id, tagPut.Tag);
            }
            catch (Exception ex)
            {
                ViewBag.Message = ex.Message;
                return(View("Edit", new TagsDTO {
                    Id = id, Tag = tagPut.Tag
                }));
            }

            return(RedirectToAction("Index"));
        }