コード例 #1
0
        public ActionResult Edit(EditPhotoViewModels photo, FormCollection collection)
        {
            Photo model = PhotoMapper.MapEditPhotoViewModel(photo);

            try
            {
                photoRepository.UdaptePhoto(model);
                return(Content(photo.Name));
            }
            catch
            {
                return(Content("Error"));
            }
        }
コード例 #2
0
        // GET: User/Edit/Edit/5
        public ActionResult Edit(EditPhotoViewModels photo)
        {
            Photo model = photoRepository.GetPhotoFromDbById(photo.Id);

            photo         = PhotoMapper.MapEditPhotoViewModel(model);
            photo.AlbumId = model.AlbumID != null ? (Guid)model.AlbumID : Guid.Empty;
            var albums = albumRepository.GettAllAlbumsByUserID(userID);

            photo.Albums.Add(new SelectListItem {
                Text = "Uncategorized", Value = Guid.Empty.ToString()
            });
            albums.ForEach(x => photo.Albums.Add(new SelectListItem {
                Text = x.Name, Value = x.Id.ToString()
            }));

            if (model.UserID == userID)
            {
                return(View(photo));
            }
            else
            {
                return(View());
            }
        }