public IHttpActionResult PostAdministrator(Administrator a) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { a.AdministratorId = db.tsp_Administrator_Insert(a.Ime, a.Prezime, a.DatumDodavanja, a.Email, a.Telefon, a.KoriniskoIme, a.LozinkaHash, a.LozinkaSalt); } catch (EntityException ex) { SqlException greska = ex.InnerException.InnerException as SqlException; if (greska != null) { return(BadRequest(Util.ExceptionHandler.DbUpdateExceptionHandler(greska))); } } return(CreatedAtRoute("DefaultApi", new { id = a.AdministratorId }, a)); }