Пример #1
0
        public RedirectResult AddTags(string tags, string fileID)
        {
            string[] tag = tags.Split(' ');

            foreach (var item in tag)
            {
                Tag newTag = new Tag();

                var getTag = from n in db.Tags
                             where n.tagName.Trim() == item
                             select n;
                if (getTag.Count() == 0)
                {
                    newTag.tagName = item;
                    db.Tags.InsertOnSubmit(newTag);
                    db.SubmitChanges();

                    sif_TagFile newTagFile = new sif_TagFile();
                    newTagFile.idFile = Int32.Parse(fileID);
                    newTagFile.idTag = newTag.idTag;
                    db.sif_TagFiles.InsertOnSubmit(newTagFile);
                    db.SubmitChanges();
                }
                else
                {
                    sif_TagFile newTagFile = new sif_TagFile();
                    newTagFile.idFile = Int32.Parse(fileID);
                    newTagFile.idTag = getTag.First().idTag;
                    db.sif_TagFiles.InsertOnSubmit(newTagFile);
                    db.SubmitChanges();
                }
            }
            return Redirect("Files");
        }
Пример #2
0
        public RedirectResult AddTag(int TaskID, string tagArray)
        {
            string[] tags = tagArray.Split(' ');

            foreach (var item in tags)
            {
                if (item == "") continue;
                Tag newTag = new Tag();

                var getTag = from n in db.Tags
                             where n.tagName.Trim() == item
                             select n;
                if (getTag.Count() == 0)
                {
                    newTag.tagName = item;
                    db.Tags.InsertOnSubmit(newTag);
                    db.SubmitChanges();

                    sifUserTask tagToAdd = new sifUserTask()
                    {
                        idTag = newTag.idTag,
                        idTask = TaskID
                    };
                    db.sifUserTasks.InsertOnSubmit(tagToAdd);
                    db.SubmitChanges();
                }
                else
                {
                    sifUserTask tagToAdd = new sifUserTask()
                    {
                        idTag = getTag.First().idTag,
                        idTask = TaskID
                    };
                    db.sifUserTasks.InsertOnSubmit(tagToAdd);
                    db.SubmitChanges();
                }
            }

            return Redirect("Index");
        }
Пример #3
0
 partial void DeleteTag(Tag instance);
Пример #4
0
 partial void UpdateTag(Tag instance);
Пример #5
0
 partial void InsertTag(Tag instance);
Пример #6
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Tag EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToTag(Tag tag)
 {
     base.AddObject("Tag", tag);
 }
Пример #7
0
 /// <summary>
 /// Create a new Tag object.
 /// </summary>
 /// <param name="idTag">Initial value of the idTag property.</param>
 /// <param name="tagName">Initial value of the tagName property.</param>
 public static Tag CreateTag(global::System.Int32 idTag, global::System.String tagName)
 {
     Tag tag = new Tag();
     tag.idTag = idTag;
     tag.tagName = tagName;
     return tag;
 }