Example #1
0
        public IActionResult SavePage()
        {
            _postServices.SavePost(_post);


            return(Json(true));
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("Post, Photo, SelectedCategories")] CreatePostViewModel createPostViewModel,
                                                 [FromServices] IPostCategoryServices postCategoryServices,
                                                 [FromServices] ICategoryServices categoryServices)
        {
            if (ModelState.IsValid)
            {
                await postServices.SavePost(createPostViewModel.Post, createPostViewModel.Photo);
                await SavePostCategory(createPostViewModel, postCategoryServices, categoryServices);

                return(RedirectToAction("Index"));
            }
            return(View(createPostViewModel));
        }