Exemplo n.º 1
0
        public async Task <IActionResult> OnPostAsync()
        {
            var user = await userManager.GetUserAsync(User);

            if (!ModelState.IsValid)
            {
                return(Page());
            }

            else
            {
                CalendarData date = new CalendarData
                {
                    Dan            = Dan,
                    Mesec          = Mesec,
                    User           = user,
                    Pocetak        = NoviPocetak,
                    Zavrestak      = NoviZavrsetak,
                    opisDogadjaja  = NoviOpisDogadjaja,
                    NazivDogadjaja = NoviDogadjaj,
                    CeoDan         = CeoDan
                };
                await db.CalendarData.AddAsync(date);

                await db.SaveChangesAsync();

                return(RedirectToPage("/UserPages/Calendar"));
            }
        }
        public async Task <IActionResult> OnPostIzbrisi(int id)
        {
            var data = await db.MaterijalData.FindAsync(id);

            db.Remove(data);
            await db.SaveChangesAsync();

            MaterijalData = await db.MaterijalData.ToListAsync();

            return(Page());
        }
Exemplo n.º 3
0
        public async Task <IActionResult> OnPost()
        {
            var user = await userManager.GetUserAsync(User);

            MaterijalData materijalData = new MaterijalData {
                NazivMaterijala = NazivMaterijala,

                PredmetMaterijala  = PredmetMaterijala,
                PitanjaMaterijala  = PitanjaMaterijala,
                brojOcenaJedan     = 0,
                brojOcenaDva       = 0,
                brojOcenaTri       = 0,
                brojOcenaCetiri    = 0,
                brojOcenaPet       = 0,
                OdgovoriMaterijala = OdgovoriMaterijala,
                User = user
            };
            await db.MaterijalData.AddAsync(materijalData);

            await db.SaveChangesAsync();

            return(RedirectToPage("/UserPages/MojiBlanketi"));
        }