Beispiel #1
0
        // To protect from overposting attacks, enable the specific properties you want to bind to, for
        // more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }


            Load load = await context.Loads.Include(l => l.IdDisciplineNavigation)
                        .Include(l => l.IdTeacherNavigation)
                        .Include(l => l.IdTypeNavigation)
                        .FirstOrDefaultAsync(m => m.IdTeacher == Load.IdTeacher && m.IdType == Load.IdType &&
                                             m.IdDiscipline == Load.IdDiscipline);

            context.Loads.Remove(load);
            await context.SaveChangesAsync();


            context.Add(new Load {
                IdType = Load.IdType, IdTeacher = Load.IdTeacher, IdDiscipline = Load.IdDiscipline
            });

            try { await context.SaveChangesAsync(); }
            catch (DbUpdateConcurrencyException)
            {
                if (!LoadExists(Load.IdTeacher))
                {
                    return(NotFound());
                }
                throw;
            }

            return(RedirectToPage("./Index"));
        }
Beispiel #2
0
        // To protect from overposting attacks, enable the specific properties you want to bind to, for
        // more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            context.Departments.Add(Department);
            await context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
Beispiel #3
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Discipline = await context.Disciplines.FindAsync(id);

            if (Discipline != null)
            {
                context.Disciplines.Remove(Discipline);
                await context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Beispiel #4
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            OccupationType = await context.OccupationTypes.FindAsync(id);

            if (OccupationType != null)
            {
                context.OccupationTypes.Remove(OccupationType);
                await context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Beispiel #5
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Load = await context.Loads.FindAsync(id);

            if (Load != null)
            {
                context.Loads.Remove(Load);
                await context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Beispiel #6
0
        // To protect from overposting attacks, enable the specific properties you want to bind to, for
        // more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            context.Attach(OccupationType).State = EntityState.Modified;

            try { await context.SaveChangesAsync(); }
            catch (DbUpdateConcurrencyException)
            {
                if (!OccupationTypeExists(OccupationType.Id))
                {
                    return(NotFound());
                }
                throw;
            }

            return(RedirectToPage("./Index"));
        }