public ActionResult Create(CategoryCreateEditModel model)
        {
            if (ModelState.IsValid)
            {
                Guid? parent = null;
                if (model.ParentCategoryId != null)
                {
                    Guid p;
                    if (Guid.TryParse(model.ParentCategoryId, out p))
                    {
                        parent = p;
                    }
                }

                BllCategory cat = new BllCategory()
                {
                    Id = model.Id,
                    Name = model.CategoryName.Trim(),
                    Description = model.Description,
                    DateCreated = DateTime.UtcNow,
                    ParentCategoryId = parent
                };

                _categoryService.Add(cat);

                return RedirectToAction("Index");
            }

            return View(model);
        }
示例#2
0
 public void Update(BllCategory category)
 {
     _categoryRepository.Update(category.ToDalCategory());
     _uow.Save();
 }
示例#3
0
 public void Add(BllCategory category)
 {
     _categoryRepository.Insert(category.ToDalCategory());
         _uow.Save();
 }