Пример #1
0
        public string Post([FromBody] paymentValues values)
        {
            if (UsersSecurity.user_id == 0 || values == null)
            {
                return("FAIL");
            }

            using (DreamFountainDBEntities entities = new DreamFountainDBEntities())
            {
                try
                {
                    entities.Backers.Add(new Backers
                    {
                        User_ID     = UsersSecurity.user_id,
                        Project_ID  = values.pr_id,
                        Amount      = values.amount,
                        DateCreated = DateTime.Now
                    });

                    entities.SaveChanges();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }

            return("SUCCESS");
        }
Пример #2
0
        public static string InsertNewAccount(string email, string password)
        {
            using (DreamFountainDBEntities entities = new DreamFountainDBEntities())
            {
                try
                {
                    entities.Users.Add(new Users
                    {
                        Email     = email,
                        Password  = password,
                        FirstName = "",
                        LastName  = "",
                        Address   = "",
                        Username  = "******"
                    });

                    entities.SaveChanges();
                }
                catch (Exception ex)
                {
                    return(ex.Message);
                }
            }
            return("SUCCESS");
        }
Пример #3
0
        public void Post([FromBody] Projects project)//[FromBody]Projects project
        {
            var userId = 2;

            using (DreamFountainDBEntities entities = new DreamFountainDBEntities())
            {
                project.User_ID = userId;
                var entity = entities.Projects.Add(project);
                entities.SaveChanges();
            }
        }
Пример #4
0
        // PUT api/userprofile/5
        //[BasicAuthenticationAttributes]
        public void Put(string password)
        {
            var userId = 2;

            using (DreamFountainDBEntities entities = new DreamFountainDBEntities())
            {
                var user = entities.Users.FirstOrDefault(x => x.User_ID == userId);
                user.Password = password;
                entities.SaveChanges();
            }
        }
Пример #5
0
        public void Post(int id, [FromBody] Users user)
        {
            var userId = 2;

            using (DreamFountainDBEntities entities = new DreamFountainDBEntities())
            {
                var entity = entities.Users.FirstOrDefault(x => x.User_ID == userId);
                entity.Password = user.Password;
                entities.SaveChanges();
            }
        }
Пример #6
0
        public void Put(int id, [FromBody] updateProjectImg images)
        {
            using (DreamFountainDBEntities entities = new DreamFountainDBEntities())
            {
                var image = new Images {
                    Data = Encoding.ASCII.GetBytes(images.image), Project_ID = id, ContentType = "dd"
                };
                entities.Images.Add(image);

                entities.SaveChanges();
            }
        }
Пример #7
0
        // POST api/values
        //[BasicAuthenticationAttributes]
        public void Post([FromBody] Users user)
        {
            var userId = 2;

            using (DreamFountainDBEntities entities = new DreamFountainDBEntities())
            {
                var entity = entities.Users.FirstOrDefault(x => x.User_ID == userId);
                entity.FirstName = user.FirstName;
                entity.LastName  = user.LastName;
                entity.Email     = user.Email;
                entities.SaveChanges();
            }
        }
Пример #8
0
        public void Put(int id, [FromBody] updateProject projects)
        {
            using (DreamFountainDBEntities entities = new DreamFountainDBEntities())
            {
                var entity = entities.Projects.FirstOrDefault(x => x.Project_ID == id);
                entity.Description    = projects.description;
                entity.Title          = projects.title;
                entity.Video          = projects.video;
                entity.Category_ID    = Int32.Parse(projects.category);
                entity.Subcategory_ID = Int32.Parse(projects.subcategory);

                entities.SaveChanges();

                ProjectImagesController img = new ProjectImagesController();
                ProjectImagesController.updateProjectImg bytes = new ProjectImagesController.updateProjectImg();
                bytes.image = projects.image;

                img.Put(id, bytes);
            }
        }