Esempio n. 1
0
 /// <summary>
 /// Delete an existing tag
 /// </summary>
 /// <param name="tag"></param>
 public void Delete(Tag tag)
 {
     //using (NHTransactionScope tx = new NHTransactionScope())
      //{
      Repository<Tag>.Delete(tag);
      //   tx.VoteCommit();
      //}
 }
Esempio n. 2
0
        /// <summary>
        /// Save or Update a tag
        /// </summary>
        /// <param name="tag"></param>
        public void Save(Tag tag)
        {
            //using (NHTransactionScope tx = new NHTransactionScope())
             //{
            // Check if the FriendlyName is unique
            long similarCount = GetCountForSimilarFriendlyNameBySite(tag.Site, tag.FriendlyName);

            if (similarCount > 0)
               tag.FriendlyName = tag.FriendlyName + "-" + (similarCount + 1).ToString();

            Repository<Tag>.Save(tag);
             //   tx.VoteCommit();
             //}
        }
Esempio n. 3
0
        public ActionResult SaveNew(string name)
        {
            Tag tag = new Tag
             {
            Name = name,
            Site = Context.ManagedSite
             };

             try
             {
               tagService.Save(tag);

               // Show the confirmation message
               MessageModel message = new MessageModel
               {
              Text = GlobalResource("Message_TagSaved"),
              Icon = MessageModel.MessageIcon.Info,
              CssClass = "margin-topbottom"
               };

               return View("MessageUserControl", message);
             }
             catch (Exception ex)
             {
            log.Error("UsersController.Update", ex);

            MessageModel message = new MessageModel
            {
               Text = GlobalResource("Message_GenericError"),
               Icon = MessageModel.MessageIcon.Alert,
               CssClass = "margin-topbottom"
            };

            return View("MessageUserControl", message);
             }
        }