Example #1
0
        public ActionResult Create([Bind(Include = "Id,Title")] ArticleCategory articleCategory)
        {
            if (ModelState.IsValid)
            {
                _repo.Add(articleCategory);
                return(RedirectToAction("Index"));
            }

            return(View(articleCategory));
        }
        public ActionResult Create(ArticleCategory articleCategory)
        {
            if (ModelState.IsValid)
            {
                _repo.Add(articleCategory);
                return(RedirectToAction("Index"));
            }

            return(View(articleCategory));
        }
        public async Task <IActionResult> Create(ArticleCategory model)
        {
            var result = await _repo.Add(model);

            if (result == null)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, new Response <ArticleCategory>()
                {
                    Succeeded = false, Message = "ثبت دسته با مشکل مواجه شد لطفا ورودی های خود را چک کرده و مجددا تلاش کنید"
                }));
            }


            return(Ok(new Response <ArticleCategory>(result)
            {
                Message = "دسته با موفقیت ثبت شد"
            }));
        }