public IHttpActionResult PutUcionica(int id, Ucionica ucionica) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != ucionica.UcionicaId) { return(BadRequest()); } db.Entry(ucionica).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!UcionicaExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutOcjenaStudent(int id, OcjenaStudent ocjenaStudent) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != ocjenaStudent.OcjenaStudentId) { return(BadRequest()); } db.Entry(ocjenaStudent).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!OcjenaStudentExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutRadnoStanje(int id, RadnoStanje radnoStanje) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != radnoStanje.RadnoStanjeId) { return(BadRequest()); } db.Entry(radnoStanje).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!RadnoStanjeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutStudent(int id, Student student) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != student.StudentId) { return(BadRequest()); } db.Entry(student).State = EntityState.Modified; try { db.SaveChanges(); } catch (Exception ex) { SqlException greska = ex.InnerException as SqlException; if (greska != null) { return(BadRequest(Util.ExceptionHandler.DbUpdateExceptionHandler(greska))); } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutKorisnickiNalog(int id, KorisnickiNalog korisnickiNalog) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != korisnickiNalog.KorisnickiNalogId) { return(BadRequest()); } db.Entry(korisnickiNalog).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!KorisnickiNalogExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutZahtjev(int id, Zahtjev zahtjev) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != zahtjev.ZahtjevId) { return(BadRequest()); } db.Entry(zahtjev).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ZahtjevExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutBanPrijavaTutor(int id, BanPrijavaTutor banPrijavaTutor) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != banPrijavaTutor.PrijavaTutorId) { return(BadRequest()); } db.Entry(banPrijavaTutor).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!BanPrijavaTutorExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutPodkategorija(int id, Podkategorija podkategorija) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != podkategorija.PodKategorijaId) { return(BadRequest()); } db.Entry(podkategorija).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!PodkategorijaExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutGrad(int id, Grad grad) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != grad.GradId) { return(BadRequest()); } db.Entry(grad).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!GradExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutMaterijal(int id, Materijal materijal) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != materijal.MaterijalId) { return(BadRequest()); } db.Entry(materijal).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!MaterijalExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PromjeniSatusBan(int id) { var tutor = db.Tutors.FirstOrDefault(x => x.TutorId == id); if (tutor == null) { return(BadRequest()); } tutor.StatusKorisnickoRacunaId = 3; if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tutor.TutorId) { return(BadRequest()); } db.Entry(tutor).State = EntityState.Modified; try { db.SaveChanges(); } catch (Exception ex) { SqlException greska = ex.InnerException as SqlException; if (greska != null) { return(BadRequest(Util.ExceptionHandler.DbUpdateExceptionHandler(greska))); } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutKorisnickiNalog(int id, KontaktInfo kontaktInfo) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != kontaktInfo.KontaktInfoId) { return(BadRequest()); } db.Entry(kontaktInfo).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException ex) { if (!KontaktInfoExists(id)) { return(NotFound()); } else { var nesto = ex.GetType().ToString(); SqlException greska = ex.InnerException as SqlException; if (greska != null) { return(BadRequest(Util.ExceptionHandler.DbUpdateExceptionHandler(greska))); } } } return(StatusCode(HttpStatusCode.NoContent)); }