Ejemplo n.º 1
0
        public async Task <ActionResult <PropDeoFest> > GetPropDeoFest(int id)
        {
            PropDeoFest propDeoFest = await _context.PropDeoFesta
                                      .FirstOrDefaultAsync(i => i.id == id);

            if (propDeoFest == null)
            {
                return(NotFound());
            }

            return(propDeoFest);
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <PropDeoFest> > DeletePropDeoFest(int id)
        {
            PropDeoFest propDeoFest = await _context.PropDeoFesta
                                      .FirstOrDefaultAsync(i => i.id == id);

            if (propDeoFest == null)
            {
                return(NotFound());
            }

            _context.Entry(propDeoFest).State = EntityState.Deleted;
            await _context.SaveChangesAsync();

            return(Ok());
        }
Ejemplo n.º 3
0
        public async Task <ActionResult <PropDeoFest> > AddPropDeoFest(PropDeoFest propDeoFest)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (ValidateModel(propDeoFest, true))
            {
                _context.PropDeoFesta.Add(propDeoFest);
                await _context.SaveChangesAsync();

                return(CreatedAtAction("GetPropDeoFest", new { id = propDeoFest.id }, propDeoFest));
            }
            else
            {
                return(BadRequest());
            }
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> UpdatePropDeoFest(PropDeoFest propDeoFest)
        {
            _context.Entry(propDeoFest).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PropDeoFestExists(propDeoFest.id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(Ok());
        }
        public async Task <IActionResult> Check(IdChecker idChecker)
        {
            if (idChecker.type == 1)
            {
                ClanOrgOdb model = await _context.ClanOrgOdbora
                                   .FirstOrDefaultAsync(i => i.id == idChecker.idChecker);

                if (model == null)
                {
                    return(Ok());
                }
            }

            if (idChecker.type == 2)
            {
                Festival model = await _context.Festivali
                                 .FirstOrDefaultAsync(i => i.id == idChecker.idChecker);

                if (model == null)
                {
                    return(Ok());
                }
            }

            if (idChecker.type == 3)
            {
                Forma model = await _context.Forme
                              .FirstOrDefaultAsync(i => i.id == idChecker.idChecker);

                if (model == null)
                {
                    return(Ok());
                }
            }

            if (idChecker.type == 4)
            {
                Glumac model = await _context.Glumci
                               .FirstOrDefaultAsync(i => i.id == idChecker.idChecker);

                if (model == null)
                {
                    return(Ok());
                }
            }

            if (idChecker.type == 5)
            {
                Nagrada model = await _context.Nagrade
                                .FirstOrDefaultAsync(i => i.id == idChecker.idChecker);

                if (model == null)
                {
                    return(Ok());
                }
            }

            if (idChecker.type == 6)
            {
                OrgOdb model = await _context.OrgOdbori
                               .FirstOrDefaultAsync(i => i.id == idChecker.idChecker);

                if (model == null)
                {
                    return(Ok());
                }
            }

            if (idChecker.type == 7)
            {
                Pozoriste model = await _context.Pozorista
                                  .FirstOrDefaultAsync(i => i.id == idChecker.idChecker);

                if (model == null)
                {
                    return(Ok());
                }
            }

            if (idChecker.type == 8)
            {
                Predstava model = await _context.Predstave
                                  .FirstOrDefaultAsync(i => i.id == idChecker.idChecker);

                if (model == null)
                {
                    return(Ok());
                }
            }

            if (idChecker.type == 9)
            {
                PropDeoFest model = await _context.PropDeoFesta
                                    .FirstOrDefaultAsync(i => i.id == idChecker.idChecker);

                if (model == null)
                {
                    return(Ok());
                }
            }

            if (idChecker.type == 10)
            {
                Radnik model = await _context.Radnici
                               .FirstOrDefaultAsync(i => i.id == idChecker.idChecker);

                if (model == null)
                {
                    return(Ok());
                }
            }

            if (idChecker.type == 11)
            {
                Reditelj model = await _context.Reditelji
                                 .FirstOrDefaultAsync(i => i.id == idChecker.idChecker);

                if (model == null)
                {
                    return(Ok());
                }
            }

            if (idChecker.type == 12)
            {
                Sala model = await _context.Sale
                             .FirstOrDefaultAsync(i => i.id == idChecker.idChecker);

                if (model == null)
                {
                    return(Ok());
                }
            }

            if (idChecker.type == 13)
            {
                Selektor model = await _context.Selektori
                                 .FirstOrDefaultAsync(i => i.id == idChecker.idChecker);

                if (model == null)
                {
                    return(Ok());
                }
            }

            if (idChecker.type == 14)
            {
                Ugovor model = await _context.Ugovori
                               .FirstOrDefaultAsync(i => i.id == idChecker.idChecker);

                if (model == null)
                {
                    return(Ok());
                }
            }

            return(BadRequest());
        }
Ejemplo n.º 6
0
 private bool ValidateModel(PropDeoFest propDeoFest, bool isPost)
 {
     return(true);
 }