Beispiel #1
0
        public ActionResult AddMark(int?score, int?id)
        {
            if (score == null)
            {
                return(HttpNotFound());
            }

            MarkDTO mark = new MarkDTO()
            {
                AuthorId  = User.Identity.GetUserId(),
                PictureId = id.Value,
                Score     = score.Value,
                Time      = DateTime.Now
            };

            try
            {
                photoService.AddMark(mark);
            }
            catch (ValidationException ex)
            {
                return(Content(ex.Message));
            }
            int photoId = id.Value;

            return(RedirectToAction("Detail", new { id = photoId }));
        }