コード例 #1
0
        public dynamic PostProfilePhoto(dynamic arg)
        {
            //TODO check if token is good and user is authorized
            UserPhoto model = null;

            try
            {
                model = this.Bind <UserPhoto>();
            }
            catch (Exception e)
            {
                return(Negotiate.WithModel("Incorrect object structure.").WithStatusCode(HttpStatusCode.BadRequest));
            }
            dao.SaveUserProfilePhoto(model);
            return(dao.GetUserProfilePhoto(model.UserID));
        }
コード例 #2
0
        private static void Deploy()
        {
            DeploymentDAO dao = new DeploymentDAO();

            dao.Redeploy();
            UserDAO registrator = new UserDAO();
            User    user1       = new User()
            {
                Email    = "*****@*****.**",
                Password = "******"
            };

            registrator.Register(user1);
            User user2 = new User()
            {
                Email    = "*****@*****.**",
                Password = "******"
            };

            registrator.Register(user2);
            UserProfileDAO profiler = new UserProfileDAO();

            user1 = profiler.GetUserByEmail(user1.Email);

            UserProfile profile = new UserProfile
            {
                UserID      = user1.ID,
                Nick        = "JhonnyJohnTheJonniest",
                Name        = "John",
                Surname     = "Johner",
                Born        = new DateTime(2000, 1, 1),
                AgeVisible  = true,
                NameVisible = true,
            };

            profiler.SaveUserProfile(profile);

            UserPhoto photo = new UserPhoto
            {
                UserID      = user1.ID,
                PhotoBase64 = Convert.ToBase64String(File.ReadAllBytes(@"Resources\emoji.png")),
            };

            profiler.SaveUserProfilePhoto(photo);
            Console.WriteLine("Redeployment done");
        }