Example #1
0
        public IActionResult UpdatePhotoForCar(int PhotoId, [FromForm] UploadPhotoDto photoDto)
        {
            var result = _photoManager.Update(PhotoId, photoDto);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
Example #2
0
        public ActionResult Photo(PhotoModel photoModel)
        {
            if (Request.IsAjaxRequest())
            {
                _photoManager.Update(new Photo
                {
                    PhotoId     = photoModel.PhotoId,
                    Title       = photoModel.Title,
                    Description = photoModel.Description
                });

                return(PartialView("_Photo", photoModel));
            }
            return(PartialView("_Photo", photoModel));
            // return View(photoModel);
        }
Example #3
0
        public JsonResult Approve(int?id)
        {
            if (id.HasValue && CurrentUser.IsAdministrator)
            {
                const bool approved = true;

                var success = _photoManager.Update(id.Value, approved);

                if (success > 0)
                {
                    return(new JsonResult {
                        Data = new { Success = true }
                    });
                }
            }

            return(new JsonResult {
                Data = new { Success = false }
            });
        }
        public JsonResult Update(SubmissionModel model)
        {
            if (model.UserId == CurrentUser.Id)
            {
                var photo = new Photo
                {
                    PhotoId     = model.PhotoId,
                    Title       = model.Title,
                    Description = model.Description,
                    UserId      = CurrentUser.Id
                };
                var success = _photoManager.Update(photo);

                _tagManager.Update(model.Tags, model.PhotoId);
                SetMessage(MessageKey.YouFuckedUp);
                return(new JsonResult {
                    Data = new { Success = true }
                });
            }

            return(new JsonResult {
                Data = new { Success = false }
            });
        }