Exemplo n.º 1
0
        public IHttpActionResult InsertZam(int id, Zamowienie zam1)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Invalid data."));
            }

            using (SMAPIEntities entities = new SMAPIEntities())
            {
                var numerKlienta = entities.Faktura.Where(p => p.FakturaID == id).FirstOrDefault();

                zam1.KlientID = numerKlienta.KlientID;

                zam1.FakturaID = id;

                var poRabacieTemp = zam1.Cena * (100 - zam1.rabat);

                zam1.PoRabacie = poRabacieTemp / 100;

                var suma = (zam1.PoRabacie * zam1.ilosc);

                zam1.Razem = suma;

                entities.Zamowienie.Add(zam1);


                entities.SaveChanges();
            }

            return(Ok());
        }
Exemplo n.º 2
0
 public Faktura Get(string nazwa)
 {
     using (SMAPIEntities entities = new SMAPIEntities())
     {
         entities.Configuration.ProxyCreationEnabled = false;
         return(entities.Faktura.Include("Klient").FirstOrDefault(e => e.Klient.nazwaKlienta == nazwa));
     }
 }
Exemplo n.º 3
0
 public Faktura Get(int id)
 {
     using (SMAPIEntities entities = new SMAPIEntities())
     {
         entities.Configuration.ProxyCreationEnabled = false;
         return(entities.Faktura.Include("Klient").FirstOrDefault(e => e.FakturaID == id));
     }
 }
Exemplo n.º 4
0
 public IEnumerable <Faktura> Get()
 {
     using (SMAPIEntities entities = new SMAPIEntities())
     {
         entities.Configuration.ProxyCreationEnabled = false;
         return(entities.Faktura.Include("Klient").ToList());
     }
 }
Exemplo n.º 5
0
 public IEnumerable <Zamowienie> Get()
 {
     using (SMAPIEntities entities = new SMAPIEntities())
     {
         entities.Configuration.ProxyCreationEnabled = false;
         return(entities.Zamowienie.Include("Towar").ToList());
     }
 }
Exemplo n.º 6
0
        public IHttpActionResult InsertFakt(Faktura faktura1)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Invalid data."));
            }

            using (SMAPIEntities entities = new SMAPIEntities())
            {
                entities.Configuration.ProxyCreationEnabled = false;

                var ostatni = entities.Faktura.Max(p => p.FakturaID);

                faktura1.NrFaktury = ostatni + 1 + "/2020";

                faktura1.Klient.numerKlienta = "QWE" + (ostatni + 1).ToString();

                entities.Faktura.Add(faktura1);

                entities.SaveChanges();
            }

            return(Ok(faktura1));
        }