Ejemplo n.º 1
0
 public async Task <IHttpActionResult> GetFaktura()
 {
     if (!LoginController.CheckAuthorizationForRequest(Request))
     {
         return(Unauthorized());
     }
     return(Ok(db.Faktura));
 }
 public async Task <IHttpActionResult> GetAnalitika_magacinske_kartice()
 {
     if (!LoginController.CheckAuthorizationForRequest(Request))
     {
         return(Unauthorized());
     }
     return(Ok(db.Analitika_magacinske_kartice));
 }
 public async Task <IHttpActionResult> GetPrijemni_dokument()
 {
     if (!LoginController.CheckAuthorizationForRequest(Request))
     {
         return(Unauthorized());
     }
     return(Ok(db.Prijemni_dokument));
 }
 public async Task <IHttpActionResult> GetJedinica_mere()
 {
     if (!LoginController.CheckAuthorizationForRequest(Request))
     {
         return(Unauthorized());
     }
     return(Ok(db.Jedinica_mere));
 }
 public async Task <IHttpActionResult> GetPoslovni_partner()
 {
     if (!LoginController.CheckAuthorizationForRequest(Request))
     {
         return(Unauthorized());
     }
     return(Ok(db.Poslovni_partner));
 }
 public async Task <IHttpActionResult> GetPoslovni_partner([FromODataUri] int key)
 {
     if (!LoginController.CheckAuthorizationForRequest(Request))
     {
         return(Unauthorized());
     }
     return(Ok(db.Poslovni_partner.Where(poslovni_partner => poslovni_partner.Id == key)));
     //return SingleResult.Create(db.Mesto.Where(mesto => mesto.Id == key));
 }
 public async Task <IHttpActionResult> GetAnalitika_magacinske_kartice([FromODataUri] int key)
 {
     if (!LoginController.CheckAuthorizationForRequest(Request))
     {
         return(Unauthorized());
     }
     return(Ok(db.Analitika_magacinske_kartice.Where(analitika_magacinske_kartice => analitika_magacinske_kartice.Id == key)));
     //return SingleResult.Create(db.Mesto.Where(mesto => mesto.Id == key));
 }
 public async Task <IHttpActionResult> GetJedinica_mere([FromODataUri] int key)
 {
     if (!LoginController.CheckAuthorizationForRequest(Request))
     {
         return(Unauthorized());
     }
     return(Ok(db.Jedinica_mere.Where(jedinica_mere => jedinica_mere.Id == key)));
     //return SingleResult.Create(db.Mesto.Where(mesto => mesto.Id == key));
 }
Ejemplo n.º 9
0
 public async Task <IHttpActionResult> GetRobna_kartica([FromODataUri] int key)
 {
     if (!LoginController.CheckAuthorizationForRequest(Request))
     {
         return(Unauthorized());
     }
     return(Ok(db.Robna_kartica.Where(robna_kartica => robna_kartica.Id == key)));
     //return SingleResult.Create(db.Mesto.Where(mesto => mesto.Id == key));
 }
 public async Task <IHttpActionResult> GetPrijemni_dokument([FromODataUri] int key)
 {
     if (!LoginController.CheckAuthorizationForRequest(Request))
     {
         return(Unauthorized());
     }
     return(Ok(db.Prijemni_dokument.Where(prijemni_dokument => prijemni_dokument.Id == key)));
     //return SingleResult.Create(db.Mesto.Where(mesto => mesto.Id == key));
 }
Ejemplo n.º 11
0
 public async Task <IHttpActionResult> GetStopa_PDV_a([FromODataUri] int key)
 {
     if (!LoginController.CheckAuthorizationForRequest(Request))
     {
         return(Unauthorized());
     }
     return(Ok(db.Stopa_PDV_a.Where(stopa_pdv_a => stopa_pdv_a.Id == key)));
     //return SingleResult.Create(db.Mesto.Where(mesto => mesto.Id == key));
 }
        // POST: odata/Analitika_magacinske_kartice
        public async Task <IHttpActionResult> Post(Analitika_magacinske_kartice analitika_magacinske_kartice)
        {
            if (!LoginController.CheckAuthorizationForRequest(Request))
            {
                return(Unauthorized());
            }
            if (!ModelState.IsValid || !analitika_magacinske_kartice.ValidateOcl())
            {
                return(BadRequest(ModelState));
            }

            db.Analitika_magacinske_kartice.Add(analitika_magacinske_kartice);
            await db.SaveChangesAsync();

            return(Created(analitika_magacinske_kartice));
        }
Ejemplo n.º 13
0
        // POST: odata/Faktura
        public async Task <IHttpActionResult> Post(Faktura faktura)
        {
            if (!LoginController.CheckAuthorizationForRequest(Request))
            {
                return(Unauthorized());
            }
            if (!ModelState.IsValid || !faktura.ValidateOcl())
            {
                return(BadRequest(ModelState));
            }

            db.Faktura.Add(faktura);
            await db.SaveChangesAsync();

            return(Created(faktura));
        }
        // POST: odata/Poslovni_partner
        public async Task <IHttpActionResult> Post(Poslovni_partner poslovni_partner)
        {
            if (!LoginController.CheckAuthorizationForRequest(Request))
            {
                return(Unauthorized());
            }
            if (!ModelState.IsValid || !poslovni_partner.ValidateOcl())
            {
                return(BadRequest(ModelState));
            }

            db.Poslovni_partner.Add(poslovni_partner);
            await db.SaveChangesAsync();

            return(Created(poslovni_partner));
        }
        // POST: odata/Prijemni_dokument
        public async Task <IHttpActionResult> Post(Prijemni_dokument prijemni_dokument)
        {
            if (!LoginController.CheckAuthorizationForRequest(Request))
            {
                return(Unauthorized());
            }
            if (!ModelState.IsValid || !prijemni_dokument.ValidateOcl())
            {
                return(BadRequest(ModelState));
            }

            db.Prijemni_dokument.Add(prijemni_dokument);
            await db.SaveChangesAsync();

            return(Created(prijemni_dokument));
        }
        // POST: odata/Jedinica_mere
        public async Task <IHttpActionResult> Post(Jedinica_mere jedinica_mere)
        {
            if (!LoginController.CheckAuthorizationForRequest(Request))
            {
                return(Unauthorized());
            }
            if (!ModelState.IsValid || !jedinica_mere.ValidateOcl())
            {
                return(BadRequest(ModelState));
            }

            db.Jedinica_mere.Add(jedinica_mere);
            await db.SaveChangesAsync();

            return(Created(jedinica_mere));
        }
Ejemplo n.º 17
0
        // DELETE: odata/Robna_kartica(5)
        public async Task <IHttpActionResult> Delete([FromODataUri] int key)
        {
            if (!LoginController.CheckAuthorizationForRequest(Request))
            {
                return(Unauthorized());
            }
            Robna_kartica robna_kartica = await db.Robna_kartica.FindAsync(key);

            if (robna_kartica == null)
            {
                return(NotFound());
            }

            db.Robna_kartica.Remove(robna_kartica);
            await db.SaveChangesAsync();

            return(StatusCode(HttpStatusCode.NoContent));
        }
        // DELETE: odata/Prijemni_dokument(5)
        public async Task <IHttpActionResult> Delete([FromODataUri] int key)
        {
            if (!LoginController.CheckAuthorizationForRequest(Request))
            {
                return(Unauthorized());
            }
            Prijemni_dokument prijemni_dokument = await db.Prijemni_dokument.FindAsync(key);

            if (prijemni_dokument == null)
            {
                return(NotFound());
            }

            db.Prijemni_dokument.Remove(prijemni_dokument);
            await db.SaveChangesAsync();

            return(StatusCode(HttpStatusCode.NoContent));
        }
        // DELETE: odata/Analitika_magacinske_kartice(5)
        public async Task <IHttpActionResult> Delete([FromODataUri] int key)
        {
            if (!LoginController.CheckAuthorizationForRequest(Request))
            {
                return(Unauthorized());
            }
            Analitika_magacinske_kartice analitika_magacinske_kartice = await db.Analitika_magacinske_kartice.FindAsync(key);

            if (analitika_magacinske_kartice == null)
            {
                return(NotFound());
            }

            db.Analitika_magacinske_kartice.Remove(analitika_magacinske_kartice);
            await db.SaveChangesAsync();

            return(StatusCode(HttpStatusCode.NoContent));
        }
        // DELETE: odata/Jedinica_mere(5)
        public async Task <IHttpActionResult> Delete([FromODataUri] int key)
        {
            if (!LoginController.CheckAuthorizationForRequest(Request))
            {
                return(Unauthorized());
            }
            Jedinica_mere jedinica_mere = await db.Jedinica_mere.FindAsync(key);

            if (jedinica_mere == null)
            {
                return(NotFound());
            }

            db.Jedinica_mere.Remove(jedinica_mere);
            await db.SaveChangesAsync();

            return(StatusCode(HttpStatusCode.NoContent));
        }
        // PUT: odata/Analitika_magacinske_kartice(5)
        public async Task <IHttpActionResult> Put([FromODataUri] int key, Delta <Analitika_magacinske_kartice> patch)
        {
            if (!LoginController.CheckAuthorizationForRequest(Request))
            {
                return(Unauthorized());
            }
            Validate(patch.GetEntity());

            if (!ModelState.IsValid || !patch.GetEntity().ValidateOcl())
            {
                return(BadRequest(ModelState));
            }

            Analitika_magacinske_kartice analitika_magacinske_kartice = await db.Analitika_magacinske_kartice.FindAsync(key);

            if (analitika_magacinske_kartice == null)
            {
                return(NotFound());
            }

            patch.Put(analitika_magacinske_kartice);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!Analitika_magacinske_karticeExists(key))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(Updated(analitika_magacinske_kartice));
        }
        // PUT: odata/Prijemni_dokument(5)
        public async Task <IHttpActionResult> Put([FromODataUri] int key, Delta <Prijemni_dokument> patch)
        {
            if (!LoginController.CheckAuthorizationForRequest(Request))
            {
                return(Unauthorized());
            }
            Validate(patch.GetEntity());

            if (!ModelState.IsValid || !patch.GetEntity().ValidateOcl())
            {
                return(BadRequest(ModelState));
            }

            Prijemni_dokument prijemni_dokument = await db.Prijemni_dokument.FindAsync(key);

            if (prijemni_dokument == null)
            {
                return(NotFound());
            }

            patch.Put(prijemni_dokument);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!Prijemni_dokumentExists(key))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(Updated(prijemni_dokument));
        }
Ejemplo n.º 23
0
        // PUT: odata/Stopa_PDV_a(5)
        public async Task <IHttpActionResult> Put([FromODataUri] int key, Delta <Stopa_PDV_a> patch)
        {
            if (!LoginController.CheckAuthorizationForRequest(Request))
            {
                return(Unauthorized());
            }
            Validate(patch.GetEntity());

            if (!ModelState.IsValid || !patch.GetEntity().ValidateOcl())
            {
                return(BadRequest(ModelState));
            }

            Stopa_PDV_a stopa_pdv_a = await db.Stopa_PDV_a.FindAsync(key);

            if (stopa_pdv_a == null)
            {
                return(NotFound());
            }

            patch.Put(stopa_pdv_a);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!Stopa_PDV_aExists(key))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(Updated(stopa_pdv_a));
        }
        public async Task <IHttpActionResult> Patch([FromODataUri] int key, Delta <Jedinica_mere> patch)
        {
            if (!LoginController.CheckAuthorizationForRequest(Request))
            {
                return(Unauthorized());
            }
            Validate(patch.GetEntity());

            if (!ModelState.IsValid || !patch.GetEntity().ValidateOcl())
            {
                return(BadRequest(ModelState));
            }

            Jedinica_mere jedinica_mere = await db.Jedinica_mere.FindAsync(key);

            if (jedinica_mere == null)
            {
                return(NotFound());
            }

            patch.Patch(jedinica_mere);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!Jedinica_mereExists(key))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(Updated(jedinica_mere));
        }