Пример #1
0
        public ActionResult Create([Bind(Include = @"Id,FilePath,FileName,AppPath,Name")] Route route)
        {
            if (ModelState.IsValid)
            {
                route.Id = Guid.NewGuid();
                _db.Routes.Add(route);
                _db.SaveChanges();
                return(RedirectToAction($"Index"));
            }

            return(View(route));
        }
        public ActionResult Create([Bind(Include = "Id,AppId,Name")] Domain domain)
        {
            if (ModelState.IsValid)
            {
                domain.Id    = Guid.NewGuid();
                domain.AppId = AppCommon.AppAttributeValue;
                _db.Domains.Add(domain);
                _db.SaveChanges();
                return(RedirectToAction($"Index"));
            }

            return(View(domain));
        }
        public ActionResult Create([Bind(Include = "Id,Sequence,Name,OfficeId")] Role role)
        {
            if (ModelState.IsValid)
            {
                role.Id = Guid.NewGuid();
                _db.Roles.Add(role);
                _db.SaveChanges();
                return(RedirectToAction($"Index"));
            }

            ViewBag.OfficeId = new SelectList(_accessUtils.GetOffices(), "Id", "Breadcrumb", role.OfficeId);
            return(View(role));
        }
Пример #4
0
 public ActionResult Create([Bind(Include = @"Id,RoleId,UserId")] RoleUser roleUser)
 {
     if (ModelState.IsValid)
     {
         roleUser.Id = Guid.NewGuid();
         _db.RoleUsers.Add(roleUser);
         _db.SaveChanges();
         return(RedirectToAction($"Index"));
     }
     ViewBag.RoleId = new SelectList(_accessUtils.GetAreasAndRoles(), $"Id", $"Name", roleUser.RoleId);
     ViewBag.UserId = new SelectList(_accessUtils.GetRolesAndUsers(), $"Id", $"Name", roleUser.UserId);
     return(View(roleUser));
 }
Пример #5
0
        public ActionResult Create([Bind(Include = "Id,AppId,OfficeId,Name")] Shop shop)
        {
            if (ModelState.IsValid)
            {
                shop.Id    = Guid.NewGuid();
                shop.AppId = AppCommon.AppAttributeValue;
                _db.Shops.Add(shop);
                _db.SaveChanges();
                return(RedirectToAction($"Index"));
            }

            ViewBag.OfficeId = new SelectList(_accessUtils.GetOffices(), "Id", "Breadcrumb", shop.OfficeId);
            return(View(shop));
        }
Пример #6
0
        public ActionResult Create([Bind(Include = "Id,AppId,DomainId,Name")] Organization organization)
        {
            if (ModelState.IsValid)
            {
                organization.Id    = Guid.NewGuid();
                organization.AppId = AppCommon.AppAttributeValue;
                _db.Organizations.Add(organization);
                _db.SaveChanges();
                return(RedirectToAction($"Index"));
            }

            ViewBag.DomainId = new SelectList(_accessUtils.GetDomains(), "Id", "Breadcrumb", organization.DomainId);
            return(View(organization));
        }
        public ActionResult Create([Bind(Include = "Id,AppId,GroupId,Name")] Office office)
        {
            if (ModelState.IsValid)
            {
                office.Id = Guid.NewGuid();
                office.AppId = AppCommon.AppAttributeValue;
                _db.Offices.Add(office);
                _db.SaveChanges();
                return RedirectToAction($"Index");
            }

            ViewBag.GroupId = new SelectList(_accessUtils.GetGroups(), "Id", "Breadcrumb", office.GroupId);
            return View(office);
        }
        public ActionResult Create([Bind(Include = "Id,AppId,OrganizationId,Name")] Group group)
        {
            if (ModelState.IsValid)
            {
                group.Id    = Guid.NewGuid();
                group.AppId = AppCommon.AppAttributeValue;
                _db.Groups.Add(group);
                _db.SaveChanges();
                return(RedirectToAction($"Index"));
            }
            ViewBag.OrganizationId = new SelectList(_accessUtils.GetOrganizations(), "Id", "Breadcrumb",
                                                    group.OrganizationId);

            return(View(group));
        }
Пример #9
0
 /// -----------------------------------------------------------------------------------------------
 /// <summary>
 ///     Determines if File exists in "AppObject" table for this application
 ///     and if not will add the new file
 /// </summary>
 /// <param name="appAttributeValue">Guid</param>
 /// <param name="files">List(AppObject)</param>
 /// -----------------------------------------------------------------------------------------------
 public void AddToTable(Guid appAttributeValue, List <Route> files)
 {
     foreach (var file in files)
     {
         var isThere = _entities.Routes.Any(f => f.RoutePath == file.RoutePath && f.AppId == appAttributeValue);
         if (!isThere)
         {
             _entities.Routes.Add(file);
             _entities.SaveChanges();
         }
     }
 }
Пример #10
0
 public ActionResult Edit([Bind(Include = @"Id,Email,PhoneNumber,UserName,SysAdmin,FirstName,LastName")]
                          UserViewModel user)
 {
     if (ModelState.IsValid)
     {
         var aspNetUser = _db.AspNetUsers.Find(user.Id);
         if (aspNetUser != null)
         {
             aspNetUser.FirstName        = user.FirstName;
             aspNetUser.LastName         = user.LastName;
             aspNetUser.UserName         = user.UserName;
             aspNetUser.Email            = user.Email;
             aspNetUser.PhoneNumber      = user.PhoneNumber;
             aspNetUser.SysAdmin         = user.SysAdmin;
             _db.Entry(aspNetUser).State = EntityState.Modified;
             _db.SaveChanges();
         }
         return(RedirectToAction($"Index"));
     }
     return(View(user));
 }