Ejemplo n.º 1
0
        public ActionResult Create(GroupViewModel viewModel)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var id = UserBL.ReadAll().First(u => u.Name == User.Identity.GetUserName()).Id;
                    viewModel.CompanyId = CompanyBL.Read(id).Id;

                    GroupBL.Create(viewModel);
                    return(RedirectToAction("../Company/Company"));
                }
                return(View(new GroupViewModel()));
            }
            catch
            {
                return(View());
            }
        }