Пример #1
0
        public async Task DeletePreviewPhotoStory(PreviewPhotoStoryViewModel input)
        {
            var photoStory = photoStoryDbSet.All().Where(x => x.Id == input.Id).FirstOrDefault();

            photoStoryDbSet.Delete(photoStory);

            await photoStoryDbSet.SaveChangesAsync();
        }
Пример #2
0
        public async Task <IActionResult> UpdatePhotoStory(PreviewPhotoStoryViewModel input)
        {
            if (ModelState.IsValid)
            {
                input.PhotographyAddictedUserId = this.User.FindFirstValue(ClaimTypes.NameIdentifier);
                var photoStoryId = await photoStoryService.UpdatePreviewPhotoStory(input);

                return(RedirectToAction("PreviewPhotoStory", "PhotoStories", new { id = photoStoryId }));
            }
            else
            {
                return(View(input));
            }
        }
Пример #3
0
        public async Task <int> UpdatePreviewPhotoStory(PreviewPhotoStoryViewModel input)
        {
            var updatePhotoStory = photoStoryDbSet.All().SingleOrDefault(t => t.Id == input.Id);

            updatePhotoStory.Author = input.Author;

            updatePhotoStory.Introduction = input.Introduction;

            updatePhotoStory.Title = input.Title;

            updatePhotoStory.Conclusion = input.Conclusion;

            await photoStoryDbSet.SaveChangesAsync();

            return((int)updatePhotoStory.Id);
        }
Пример #4
0
        public async Task <IActionResult> DeletePhotoStory(PreviewPhotoStoryViewModel input)
        {
            await photoStoryService.DeletePreviewPhotoStory(input);

            return(RedirectToAction("PreviewPhotoStories", "PhotoStories"));
        }