Exemplo n.º 1
0
        public void AddSearchString(SearchStringsCategory sString)
        {
            var editedString = entity.SearchStrings.Find(sString.ID);

            if (editedString == null)
            {
                if (sString.SearchStringGroupID == null)
                {
                    int lastID = lastSearchStringGroupID();
                    lastID = lastID + 1;
                    string LastID = lastID.ToString();
                    sString.SearchStringGroupID = LastID;
                }
                entity.SearchStrings.Add(sString);
            }
            else
            {
                addPoints(sString.PostedBy);
                editedString.SearchString        = sString.SearchString;
                editedString.CategoryID          = sString.CategoryID;
                editedString.SearchStringGroupID = sString.SearchStringGroupID;
                editedString.Available           = sString.Available;
                editedString.PostedBy            = sString.PostedBy;
            }
            entity.SaveChanges();
        }
Exemplo n.º 2
0
        public void RemoveSearchString(SearchStringsCategory SearchString)
        {
            var searchString = new SearchStringsCategory {
                ID = SearchString.ID
            };

            entity.SearchStrings.Attach(searchString);
            entity.SearchStrings.Remove(searchString);
            entity.SaveChanges();
        }