예제 #1
0
        public Tag UpdateOne(EditTagModel model)
        {
            var tag = _providerTag.UpdateOne(_converter.ConvertTo(model));

            _providerTag.Commit();
            return(tag);
        }
예제 #2
0
        public ActionResult EditTag(EditTagModel model)
        {
            if (!ModelState.IsValid)
            {
                return(PartialView("_EditTag", model));
            }

            try
            {
                if (model.Id == 0)
                {
                    _tagService.AddOne(model);
                }
                else
                {
                    _tagService.UpdateOne(model);
                }
            }
            catch (Exception exception)
            {
                Log.RegisterError(exception);
            }

            return(RedirectToAction("TagIndex"));
        }
예제 #3
0
        public IActionResult Edit(EditTagModel tagParams)
        {
            var tagData = _mapper.Map <TagDTO>(tagParams);

            _tagService.Edit(tagData);

            return(Json("OK"));
        }
예제 #4
0
 public Tag ConvertTo(EditTagModel model)
 {
     return(new Tag()
     {
         Id = model.Id,
         TitleRu = model.TitleRu,
         TitleEng = model.TitleEng,
     });
 }
예제 #5
0
        public ActionResult Edit(string id)
        {
            Tag          retrievedTag = _tagRepository.RetrieveTagByNameAndUserId(id, Owner.Id);
            EditTagModel model        = new EditTagModel
            {
                TagDescription = retrievedTag.Description,
                TagText        = retrievedTag.TagText,
                OrginalTagText = retrievedTag.TagText
            };

            return(View(model));
        }
예제 #6
0
        public ActionResult EditTag(int id)
        {
            var tag = _tagService.GetOne(id);

            var model = new EditTagModel()
            {
                Id       = tag.Id,
                TitleEng = tag.TitleEng,
                TitleRu  = tag.TitleRu
            };

            return(PartialView("_EditTag", model));
        }
예제 #7
0
        public ActionResult Edit(EditTagModel model)
        {
            Tag tag    = _tagRepository.RetrieveTagByNameAndUserId(model.OrginalTagText, Owner.Id);
            Tag newTag = new Tag(model.TagText)
            {
                Description = model.TagDescription ?? string.Empty,
                Id          = tag.Id
            };

            _tagRepository.Update(newTag, Owner.Id);
            model.UIMessage = "Tag successfully updated.";

            return(View(model));
        }
예제 #8
0
        public IActionResult OnGet(Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var tag = _tagService.Get(id);

            Tag = _mapper.Map <EditTagModel>(tag);

            if (Tag == null)
            {
                return(NotFound());
            }
            return(Page());
        }