public async Task <IActionResult> Delete(DeleteJobCategoryViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var category = _mapper.Map <JobCategory>(model);
            var result   = await _jobCategoryService.Delete(category);

            if (result)
            {
                return(RedirectToAction(nameof(Index)));
            }

            return(View("NotFound"));
        }
Пример #2
0
        public ActionResult Delete(int id)
        {
            var jobCategory = jobCategoryService.GetById(id);

            if (jobCategory == null)
            {
                this.NotifyError("Item not found.");
                return(RedirectToAction("List"));
            }
            else
            {
                var deleted = jobCategoryService.Delete(jobCategory);
                if (deleted)
                {
                    this.NotifySuccess("Successfully deleted.");
                }
                else
                {
                    this.NotifyError("Item can not deleted!");
                }
            }

            return(RedirectToAction("List"));
        }