Example #1
0
        public async Task <IActionResult> Insert(NewsGroupInsertViewModel model)
        {
            var result = await _newsGroupRepository.AddAsync(model);

            TempData.AddResult(result);

            return(Redirect(IndexUrlWithQueryString));
        }
Example #2
0
        public async Task <IActionResult> Insert(NewsGroupInsertViewModel model)
        {
            var result = await _newsGroupRepository.AddAsync(model);

            TempData.AddResult(result);

            return(RedirectToAction("Index"));
        }
Example #3
0
        /// <summary>
        /// ثبت یک آیتم در جدول مورد نظر
        /// </summary>
        /// <param name="model">مدلی که از سمت کلاینت در حال پاس دادن آن هستیم</param>
        /// <returns></returns>
        public async Task <SweetAlertExtenstion> AddAsync(NewsGroupInsertViewModel model)
        {
            try
            {
                var entity = Mapper.Map <NewsGroup>(model);
                await AddAsync(entity);

                return(SweetAlertExtenstion.Ok());
            }
            catch
            {
                return(SweetAlertExtenstion.Error());
            }
        }