Пример #1
0
        public ActionResult Create(JobCategoryModel model)
        {
            if (ModelState.IsValid)
            {
                var jobCategory = new JobCategory
                {
                    Name     = model.Name,
                    IsActive = model.IsActive
                };

                var result = jobCategoryService.Insert(jobCategory);
                if (result)
                {
                    this.NotifySuccess("Successfully saved.");
                }
                else
                {
                    this.NotifyError("Item can not saved!");
                }

                var urlRecord = new UrlRecord
                {
                    EntityId   = jobCategory.Id,
                    EntityName = nameof(JobCategory),
                    Slug       = model.Name.ToUrlSlug()
                };
                urlService.Save(urlRecord);

                return(RedirectToAction("Edit", new { Id = jobCategory.Id }));
            }

            return(View(model));
        }