public string Add(Users newUser)
        {
            var checkusername = from usr in db.User
                                where usr.UserName.Equals(newUser.UserName)
                                select usr;

            if (checkusername.Count() > 0)
            {
                return("User Name Already Exists");
            }
            db.Add(newUser);
            return("Added");
        }
示例#2
0
        public string Add(Videos newVideo)
        {
            var checkvidname = from vid in db.Video
                               where vid.VideoName.Equals(newVideo.VideoImage)
                               select vid;

            if (checkvidname.Count() > 0)
            {
                return("Video with this name already exists");
            }
            db.Add(newVideo);
            return("New Video Added");
        }