public dynamic PostProfile(dynamic arg) { //TODO check if token is good and user is authorized UserProfile model = null; try { model = this.Bind <UserProfile>(); } catch { return(Negotiate.WithModel("Incorrect object structure.").WithStatusCode(HttpStatusCode.BadRequest)); } dao.SaveUserProfile(model); return(dao.GetUserProfile(model.UserID)); }
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"); }