Exemple #1
0
        public string DeleteCategory(string username, string categoryname)
        {
            MemberShip   member       = new MemberShip();
            int          userid       = member.getUserIdByName(username);
            UserCategory usercategory = db.UserCategory.First(c => c.categoryname == categoryname && c.userid == userid);

            db.UserCategory.Remove(usercategory);
            db.SaveChanges();
            return("true");
        }
Exemple #2
0
        public string CreateCategory(string username, string categoryname)
        {
            MemberShip member       = new MemberShip();
            int        userid       = member.getUserIdByName(username);
            var        usercategory = new UserCategory
            {
                categoryname = categoryname,
                userid       = userid
            };

            db.UserCategory.Add(usercategory);
            db.SaveChanges();
            return("true");
        }