public async Task <IActionResult> UpdateSala(Sala sala) { foreach (var predstava in sala.predstave) { _context.Entry(predstava).State = EntityState.Unchanged; } _context.Entry(sala).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SalaExists(sala.id)) { return(NotFound()); } else { throw; } } return(Ok()); }
public async Task <IActionResult> UpdatePredstava(Predstava predstava) { //foreach (var reditelj in predstava.reditelji) //{ // _context.Entry(reditelj).State = EntityState.Unchanged; //} //foreach (var glumac in predstava.glumci) //{ // _context.Entry(glumac).State = EntityState.Unchanged; //} _context.Entry(predstava.izabran).State = EntityState.Unchanged; _context.Entry(predstava).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PredstavaExists(predstava.id)) { return(NotFound()); } else { throw; } } return(Ok()); }
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)); }
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)); }
public async Task <IActionResult> UpdateUgovor(Ugovor model) { _context.Entry(model).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ModelExists(model.id)) { return(NotFound()); } else { throw; } } return(Ok()); }
public async Task <IActionResult> UpdateForma(Forma forma) { _context.Entry(forma).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FormaExists(forma.id)) { return(NotFound()); } else { throw; } } return(Ok()); }
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 <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()); } }
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 <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()); } }