Exemplo n.º 1
0
        public ActionResult Edit(EditViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View("_Edit", model));
            }

            _postCategoryService.Edit(model.PostCategoryId, model.PostCategoryName);

            return(Content("Refresh"));
        }
Exemplo n.º 2
0
        public virtual async Task <ActionResult> Add(AddPostCategoryViewModel categoryModel)
        {
            var postCategory = new Iris.DomainClasses.PostCategory();

            {
            };

            _mappingEngine.Map(categoryModel, postCategory);

            if (categoryModel.Id.HasValue)
            {
                _categoryService.Edit(postCategory);
            }
            else
            {
                _categoryService.Add(postCategory);
            }

            await _unitOfWork.SaveAllChangesAsync();

            return(Json(new { id = postCategory.Id, success = true }));
        }