Ejemplo n.º 1
0
        public string GetProjectInfo(string toolIdString)
        {
            int toolId;
            if (!int.TryParse(toolIdString, out toolId))
                throw new InvalidDataException("Tool Id did not parse to INT");

            var db = new codingtoolsdevEntities();
            var list = db.get_Tool_Page(toolId).ToList();

            return new JavaScriptSerializer().Serialize(_ProjectInfoHelper(list));
        }
Ejemplo n.º 2
0
        public string GetReviewList(string toolIdString)
        {
            int toolId;
            if (!int.TryParse(toolIdString, out toolId))
                throw new InvalidDataException("Tool Id did not parse to INT");

            var db = new codingtoolsdevEntities();
            var list = db.get_ReviewsList(toolId).ToList();
            var reviewList = new ReviewList
            {
                Reviews = list,
                Chart = _ProjectReviewHelper(list)
            };
            return new JavaScriptSerializer().Serialize(reviewList);
        }
Ejemplo n.º 3
0
        public int AddUser(string name, string email, string title, string username, string password)
        {
            var db = new codingtoolsdevEntities();

            if (password==null)
                throw new InvalidDataException("Password cannot be null");

            //encryption
            byte[] salt = (new Rfc2898DeriveBytes(password, 64)).Salt;
            byte[] hash = (new Rfc2898DeriveBytes(password, salt)).GetBytes(64);

            if (name.Equals(null))
                throw new InvalidDataException("Name cannot be null");
            if (email.Equals(null))
                throw new InvalidDataException("Email cannot be null");
            if (username.Equals(null))
                throw new InvalidDataException("Username cannot be null");

            return db.insert_user(name, email, title, username, salt, hash);
        }
Ejemplo n.º 4
0
 public string GetToolList()
 {
     var db = new codingtoolsdevEntities();
     var list = db.get_ToolList().ToList();
     //var toolList = _ToolListHelper(list);
     var tags = db.get_TagList().ToList();
     return new JavaScriptSerializer().Serialize(new ListViewInitModel
     {
         ToolList = _ToolListHelper(list),
         TagList = _GenerateTagLists(tags)
     });
 }
Ejemplo n.º 5
0
 public string SubmitReview(int userId, int toolId, string title, int rating, string description)
 {
     var db = new codingtoolsdevEntities();
     var reviewId = db.submit_Quiz_Answers(userId, toolId, title, rating, description);
     return GetReviewList(toolId+"");
 }