Esempio n. 1
0
        public ActionResult Create([Bind(Include = "DeviceId,DeviceBrand,DeviceModel,DeviceColor,DeviceMemory")] Device device)
        {
            if (ModelState.IsValid)
            {
                db.Devices.Add(device);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(device));
        }
Esempio n. 2
0
        public ActionResult Create([Bind(Include = "DeviceReferenceId,DeviceModel,DeviceBrand,DeviceColor,DeviceCapacity,DeviceBattery,DeviceDescription")] DeviceReference deviceReference)
        {
            if (ModelState.IsValid)
            {
                db.deviceReference.Add(deviceReference);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(deviceReference));
        }
Esempio n. 3
0
        public ActionResult Create([Bind(Include = "BrandId,BrandName")] Brand brand)
        {
            if (ModelState.IsValid)
            {
                db.Brands.Add(brand);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(brand));
        }
Esempio n. 4
0
 private static void SeedOperatives(RepairsContext ctx)
 {
     ctx.Operatives.AddRange(new List <Operative>()
     {
         new Operative {
             Id = OperativeId, IsArchived = false, Name = "James o Operative", PayrollNumber = OperativePayrollId, Email = OperativeEmail
         }
     });
     ctx.SaveChanges();
 }
Esempio n. 5
0
        private static void SeedSecurityGroups(RepairsContext ctx)
        {
            ctx.SecurityGroups.AddRange(new List <SecurityGroup>
            {
                new SecurityGroup {
                    GroupName = UserGroups.Agent, UserType = UserGroups.Agent
                },
                new SecurityGroup {
                    GroupName = UserGroups.ContractManager, UserType = UserGroups.ContractManager, VaryLimit = 10000000000
                },
                new SecurityGroup {
                    GroupName = ContractManagerLimit1000, UserType = UserGroups.ContractManager, VaryLimit = 1000
                },
                new SecurityGroup {
                    GroupName = UserGroups.Contractor, UserType = UserGroups.Contractor, ContractorReference = "contractor"
                },
                new SecurityGroup {
                    GroupName = DRSContractor, UserType = UserGroups.Contractor, ContractorReference = DRSContractor
                },
                new SecurityGroup {
                    GroupName = UserGroups.AuthorisationManager, UserType = UserGroups.AuthorisationManager, RaiseLimit = 10000000000
                },
                new SecurityGroup {
                    GroupName = AuthorisationManagerLimit1000, UserType = UserGroups.AuthorisationManager, RaiseLimit = 1000
                },
                new SecurityGroup {
                    GroupName = UserGroups.AuthorisationManager, UserType = UserGroups.Agent
                },

                new SecurityGroup {
                    GroupName = MultiContractor, UserType = UserGroups.Contractor, ContractorReference = DRSContractor
                },
                new SecurityGroup {
                    GroupName = MultiContractor, UserType = UserGroups.Contractor, ContractorReference = Contractor
                },

                new SecurityGroup {
                    GroupName = "raise50", RaiseLimit = 50
                },
                new SecurityGroup {
                    GroupName = "raise100", RaiseLimit = 100
                },
                new SecurityGroup {
                    GroupName = "raise150", RaiseLimit = 150
                },

                new SecurityGroup {
                    GroupName = "vary50", VaryLimit = 50
                },
                new SecurityGroup {
                    GroupName = "vary100", VaryLimit = 100
                },
                new SecurityGroup {
                    GroupName = "vary150", VaryLimit = 150
                },
                new SecurityGroup {
                    GroupName = UserGroups.Operative, UserType = UserGroups.Operative
                },
            });
            ctx.SaveChanges();
        }