public ActionResult Edit(int?id) { if (id.HasValue) { Photo photo = _photoManager.Get(id.Value, true); var userId = Request.IsAuthenticated ? CurrentUser.Id : 0; var rating = _ratingManager.Get(new Rating { PhotoId = id.Value, UserId = userId }); var photoModel = new PhotoModel { PhotoId = photo.PhotoId, UserId = photo.UserId, Description = photo.Description, Title = photo.Title, FileName = photo.FileName, Tags = _tagManager.Get(photo.PhotoId), Width = "" + photo.Width + "px", Height = "" + photo.Height + "px", Rating = rating }; photoModel.TagString = string.Join(", ", photoModel.Tags); return(PartialView("_Edit", photoModel)); } return(View("Error", new ErrorModel { ErrorMessage = "No photo Id was Provided" })); }