Ejemplo n.º 1
0
        public ActionResult Create(int id)
        {
            var model = new PosCategoryViewModel();

            model.Organization = _organizationRepository.Organizations.Single(x => x.Id == id);
            model.Category     = new Category {
                OrganizationId = id
            };
            return(View(model));
        }
Ejemplo n.º 2
0
        public ActionResult Create(PosCategoryViewModel model)
        {
            try
            {
                InfoFormat("User #{0} creating category...", User.Identity.Name);
                model.Organization = _organizationRepository.GetById(model.Category.OrganizationId);
                model.Category     = _repository.Save(model.Category);
            } catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(View(model));
            }

            SetTempOkMessage("Category was successfully saved");
            return(RedirectToAction("list", new { id = model.Category.OrganizationId }));
        }