public async Task <ActionResult <OrgOdb> > AddOrgOdb(OrgOdb model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (ValidateModel(model, true))
            {
                _context.Entry(model.clanOrgOdbora1).State = EntityState.Unchanged;
                _context.Entry(model.clanOrgOdbora2).State = EntityState.Unchanged;
                _context.Entry(model.clanOrgOdbora3).State = EntityState.Unchanged;

                _context.Entry(model.selektor).State = EntityState.Unchanged;

                _context.OrgOdbori.Add(model);
                await _context.SaveChangesAsync();

                return(CreatedAtAction("GetOrgOdb", new { id = model.id }, model));
            }
            else
            {
                return(BadRequest());
            }
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <Predstava> > AddUgovor(Ugovor model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (ValidateModel(model, true))
            {
                _context.Ugovori.Add(model);
                await _context.SaveChangesAsync();

                return(CreatedAtAction("GetUgovor", new { id = model.id }, model));
            }
            else
            {
                return(BadRequest());
            }
        }
Ejemplo n.º 3
0
        public async Task <ActionResult <Sala> > AddSala(Sala sala)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (ValidateModel(sala, true))
            {
                _context.Sale.Add(sala);
                await _context.SaveChangesAsync();

                return(CreatedAtAction("GetSala", new { id = sala.id }, sala));
            }
            else
            {
                return(BadRequest());
            }
        }
        public async Task <ActionResult <ClanOrgOdb> > AddClanOrgOdb(ClanOrgOdb model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (ValidateModel(model, true))
            {
                _context.ClanOrgOdbora.Add(model);
                await _context.SaveChangesAsync();

                return(CreatedAtAction("GetClanOrgOdb", new { id = model.id }, model));
            }
            else
            {
                return(BadRequest());
            }
        }
        public async Task <ActionResult <Pozoriste> > AddForma(Forma forma)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (ValidateModel(forma, true))
            {
                _context.Forme.Add(forma);
                await _context.SaveChangesAsync();

                return(CreatedAtAction("GetForma", new { id = forma.id }, forma));
            }
            else
            {
                return(BadRequest());
            }
        }
Ejemplo n.º 6
0
        public async Task <ActionResult <Predstava> > AddPredstava(Predstava predstava)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (ValidateModel(predstava, true))
            {
                _context.Predstave.Add(predstava);
                await _context.SaveChangesAsync();

                return(CreatedAtAction("GetPredstava", new { id = predstava.id }, predstava));
            }
            else
            {
                return(BadRequest());
            }
        }
        public async Task <ActionResult <Reditelj> > AddReditelj(Reditelj model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (ValidateModel(model, true))
            {
                _context.Reditelji.Add(model);
                await _context.SaveChangesAsync();

                return(CreatedAtAction("GetReditelj", new { id = model.id }, model));
            }
            else
            {
                return(BadRequest());
            }
        }
Ejemplo n.º 8
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.º 9
0
        public async Task <ActionResult <Nagrada> > AddNagrada(Nagrada model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (ValidateModel(model, true))
            {
                _context.Nagrade.Add(model);
                await _context.SaveChangesAsync();

                return(CreatedAtAction("GetNagrada", new { id = model.id }, model));
            }
            else
            {
                return(BadRequest());
            }
        }
Ejemplo n.º 10
0
        public async Task <ActionResult <Glumac> > AddGlumac(Glumac model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (ValidateModel(model, true))
            {
                _context.Glumci.Add(model);
                await _context.SaveChangesAsync();

                return(CreatedAtAction("GetGlumac", new { id = model.id }, model));
            }
            else
            {
                return(BadRequest());
            }
        }
        public async Task <ActionResult <Festival> > AddFestival(Festival festival)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (ValidateModel(festival, true))
            {
                _context.Entry(festival.pozoriste).State = EntityState.Unchanged;
                _context.Entry(festival.forma).State     = EntityState.Unchanged;
                _context.Festivali.Add(festival);
                await _context.SaveChangesAsync();

                return(CreatedAtAction("GetFestival", new { id = festival.id }, festival));
            }
            else
            {
                return(BadRequest());
            }
        }
        public async Task <ActionResult <Pozoriste> > AddPozoriste(Pozoriste pozoriste)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (ValidateModel(pozoriste, true))
            {
                foreach (var sala in pozoriste.sale)
                {
                    _context.Entry(sala).State = EntityState.Unchanged;
                }
                _context.Pozorista.Add(pozoriste);
                await _context.SaveChangesAsync();

                return(CreatedAtAction("GetPozoriste", new { id = pozoriste.id }, pozoriste));
            }
            else
            {
                return(BadRequest());
            }
        }
Ejemplo n.º 13
0
        public async Task <ActionResult <Izabran> > AddIzabran(Izabran model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (ValidateModel(model, true))
            {
                _context.Entry(model.nagrada).State   = EntityState.Unchanged;
                _context.Entry(model.ugovor).State    = EntityState.Unchanged;
                _context.Entry(model.OrgOdb).State    = EntityState.Unchanged;
                _context.Entry(model.Pozoriste).State = EntityState.Unchanged;
                _context.Izabrani.Add(model);
                await _context.SaveChangesAsync();

                return(CreatedAtAction("GetIzabran", new { id = model.id }, model));
            }
            else
            {
                return(BadRequest());
            }
        }
        public async Task <ActionResult <Glumi> > AddGlumi(Glumi model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.Entry(model.predstava).State = EntityState.Unchanged;
            _context.Entry(model.glumac).State    = EntityState.Unchanged;

            _context.Glume.Add(model);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetGlumi", new { id = model.id }, model));
        }
        public async Task <ActionResult <Realizuje> > AddRealizuje(Realizuje model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.Entry(model.predstava).State = EntityState.Unchanged;
            _context.Entry(model.reditelj).State  = EntityState.Unchanged;

            _context.Realizuju.Add(model);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetRealizuje", new { id = model.id }, model));
        }
Ejemplo n.º 16
0
        public async Task <ActionResult <Priredi> > AddPriredi(Priredi model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.Entry(model.propDeoFest).State = EntityState.Unchanged;
            _context.Entry(model.pozoriste).State   = EntityState.Unchanged;

            _context.Prirede.Add(model);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPriredi", new { id = model.id }, model));
        }