public FakultetFullDto VratiFakultetFull([FromUri] int id, [FromUri] string sid)
        {
            try
            {
                SesijeProvajder.OtvoriSesiju();

                if (!ProvajderPodatakaKorisnika.SesijaValidna(sid))
                {
                    throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound)
                    {
                        Content = new StringContent("Sesija istekla")
                    });
                }

                if (!ValidatorPrivilegija.KorisnikImaPrivilegiju(sid, ValidatorPrivilegija.UserPrivilegies.CitanjeFakultet))
                {
                    throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden)
                    {
                        Content = new StringContent("Nemate privilegiju")
                    });
                }

                Fakultet        f        = null;
                FakultetFullDto fakultet = new FakultetFullDto();

                f = ProvajderPodatakaFakulteta.VratiFakultet(id);
                if (f == null)
                {
                    throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound)
                    {
                        Content = new StringContent("Fakultet nije pronadjen")
                    });
                }

                fakultet.IdFakultet = f.IdFakultet;
                fakultet.Naziv      = f.Naziv;
                return(fakultet);
            }
            catch (Exception e)
            {
                if (e is HttpResponseException)
                {
                    throw e;
                }
                DnevnikIzuzetaka.Zabelezi(e);
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError)
                {
                    Content = new StringContent("InternalError: " + e.Message)
                });
            }
            finally
            {
                SesijeProvajder.ZatvoriSesiju();
            }
        }
        public IHttpActionResult UpdateFakultet([FromBody] FakultetFullDto fdto, [FromUri] string sid)
        {
            try
            {
                SesijeProvajder.OtvoriSesiju();

                if (!ProvajderPodatakaKorisnika.SesijaValidna(sid))
                {
                    throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound)
                    {
                        Content = new StringContent("Sesija istekla")
                    });
                }

                if (!ValidatorPrivilegija.KorisnikImaPrivilegiju(sid, ValidatorPrivilegija.UserPrivilegies.ModifikacijaFakultet))
                {
                    throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden)
                    {
                        Content = new StringContent("Nemate privilegiju")
                    });
                }

                Fakultet f = ProvajderPodatakaFakulteta.VratiFakultet(fdto.IdFakultet);

                if (f == null)
                {
                    throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound)
                    {
                        Content = new StringContent("Fakultet za modifikaciju nije pronadjen")
                    });
                }


                f.Naziv = fdto.Naziv;
                ProvajderPodatakaFakulteta.UpdateFakultet(f);
                return(Ok("Fakutet uspesno modifikovan"));
            }
            catch (Exception e)
            {
                if (e is HttpResponseException)
                {
                    throw e;
                }
                DnevnikIzuzetaka.Zabelezi(e);
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError)
                {
                    Content = new StringContent("InternalError: " + e.Message)
                });
            }
            finally
            {
                SesijeProvajder.ZatvoriSesiju();
            }
        }
        public IHttpActionResult ObrisiFakultet([FromUri] int id, [FromUri] string sid)
        {
            try
            {
                SesijeProvajder.OtvoriSesiju();

                if (!ProvajderPodatakaKorisnika.SesijaValidna(sid))
                {
                    throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound)
                    {
                        Content = new StringContent("Sesija istekla")
                    });
                }

                if (!ValidatorPrivilegija.KorisnikImaPrivilegiju(sid, ValidatorPrivilegija.UserPrivilegies.BrisanjeFakultet))
                {
                    throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden)
                    {
                        Content = new StringContent("Nemate privilegiju")
                    });
                }

                Fakultet f = null;
                f = ProvajderPodatakaFakulteta.VratiFakultet(id);
                if (f == null)
                {
                    throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound)
                    {
                        Content = new StringContent("Fakultet za brisanje nije pronadjen")
                    });
                }

                ProvajderPodatakaFakulteta.ObrisiFakultet(id);
                return(Ok("Fakutet uspesno obrisan"));
            }
            catch (Exception e)
            {
                if (e is HttpResponseException)
                {
                    throw e;
                }
                DnevnikIzuzetaka.Zabelezi(e);
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError)
                {
                    Content = new StringContent("Fakultet nije moguce obrisati")
                });
            }
            finally
            {
                SesijeProvajder.ZatvoriSesiju();
            }
        }