Exemple #1
0
        public IHttpActionResult UpdateUserPhoto([FromBody] PhotoBindingModel model)
        {
            User user = GetCurrentUser();

            int imageId = UserService.Obj.UpdateOrCreatePhoto(user, model.Photo);

            return(Ok(imageId));
        }
        public ActionResult UploadFile(PhotoBindingModel model)
        {
            if (ModelState.IsValid)
            {
                if (model.Upload != null)
                {
                    var paths = Helpers.UploadFiles.UploadImage(model.Upload, false);

                    var photo = new Picture
                    {
                        ImageURL = DropBox.Download(paths[0]),
                        Owner = this.UserProfile
                    };

                    this.UserProfile.Pictures.Add(photo);
                    this.Data.SaveChanges();
                    this.TempData["Success"] = new[] { "Edit successfull" };
                }

                return this.View();

            }
            return new HttpStatusCodeResult(HttpStatusCode.BadRequest, "Invalid model");
        }