コード例 #1
0
 public CreateModel(Socona.ImVehicle.Core.Data.VehicleDbContext context, IAuthorizationService authorizationService, ITownService townService, UserManager <VehicleUser> userManager,
                    IGroupService groupService)
 {
     _context = context;
     _authorizationService = authorizationService;
     _townService          = townService;
     _userManager          = userManager;
     _groupService         = groupService;
     SecurityPerson        = new SecurityPerson();
 }
コード例 #2
0
        public async Task <IActionResult> OnGetAsync(long?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            SecurityPerson = await _context.SecurityPersons
                             .Include(s => s.Group)
                             .Include(s => s.Town).SingleOrDefaultAsync(m => m.Id == id);

            if (SecurityPerson == null)
            {
                return(NotFound());
            }
            return(Page());
        }
コード例 #3
0
        public async Task <IActionResult> OnPostAsync(long?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            SecurityPerson = await _context.SecurityPersons.FindAsync(id);

            if (SecurityPerson != null)
            {
                _context.SecurityPersons.Remove(SecurityPerson);
                await _context.SaveChangesAsync();
            }

            return(Redirect(Url.GetLocalUrl(ReturnUrl)));
        }
コード例 #4
0
ファイル: Edit.cshtml.cs プロジェクト: sconan32/ImVehicleMIS
        public async Task <IActionResult> OnGetAsync(long?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            SecurityPerson = await _context.SecurityPersons
                             .Include(s => s.Group)
                             .Include(s => s.Town).SingleOrDefaultAsync(m => m.Id == id);

            if (SecurityPerson == null)
            {
                return(NotFound());
            }
            ViewData["GroupId"] = new SelectList(_context.Groups, "Id", "Id");
            ViewData["TownId"]  = new SelectList(_context.Towns, "Id", "Id");
            return(Page());
        }
コード例 #5
0
 private void CreateThreeObjects()
 {
     using (DbContextSecurityObject dbContextConnectionClass = new DbContextSecurityObject()) {
         dbContextConnectionClass.ResetDatabase();
         SecurityCompany company = new SecurityCompany();
         company.Name        = "1";
         company.Description = "1";
         dbContextConnectionClass.Add(company);
         for (int i = 1; i < 4; i++)
         {
             string         indexString = i.ToString();
             SecurityPerson person      = new SecurityPerson();
             person.Name            = indexString;
             person.Description     = indexString;
             person.SecurityCompany = company;
             dbContextConnectionClass.Add(person);
         }
         dbContextConnectionClass.SaveChanges();
     }
 }