コード例 #1
0
ファイル: HomeController.cs プロジェクト: GYumurtac/KargoApi
        public HttpResponseMessage KargoTakipEt(Guid kargoTakip)
        {
            try
            {
                if (kargoTakip != null)
                {
                    if (krep.Any(x => x.GonderiNo == kargoTakip))
                    {
                        Kargo kargo = krep.FirstOrDefault(x => x.GonderiNo == kargoTakip);

                        List <HareketVM> hareketler = hrep.GetActives().Where(x => x.KargoID == kargo.ID).Select(x => new HareketVM {
                            KargoDetay = x.Aciklama, KargoDurum = x.Durum, KargoKonum = x.Birim, Tarih = x.CreatedDate
                        }).ToList();

                        return(Request.CreateResponse(HttpStatusCode.OK, hareketler));
                    }
                    return(Request.CreateResponse(HttpStatusCode.NotFound, "Böyle bir kargo bulunamadı."));
                }
                return(Request.CreateResponse(HttpStatusCode.NotFound, "Böyle bir kargo bulunamadı."));
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, ex));
            }
        }
コード例 #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            Kargo kargo = db.Kargo.Find(id);

            db.Kargo.Remove(kargo);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            Kargo kargo = await db.Kargoes.FindAsync(id);

            db.Kargoes.Remove(kargo);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
コード例 #4
0
 public ActionResult Edit([Bind(Include = "KargoID,KargoAdi,KargoResmi")] Kargo kargo)
 {
     if (ModelState.IsValid)
     {
         db.Entry(kargo).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(kargo));
 }
コード例 #5
0
 public ActionResult Edit([Bind(Include = "kargoID,kargoAdi,kargoAdresi,kargoTelefon,kargoWeb,kargoEmail")] Kargo kargo)
 {
     if (ModelState.IsValid)
     {
         db.Entry(kargo).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(kargo));
 }
コード例 #6
0
        public ActionResult Create([Bind(Include = "kargoID,kargoAdi,kargoAdresi,kargoTelefon,kargoWeb,kargoEmail")] Kargo kargo)
        {
            if (ModelState.IsValid)
            {
                db.Kargo.Add(kargo);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(kargo));
        }
        public async Task <ActionResult> Edit([Bind(Include = "Id,KargoAdi")] Kargo kargo)
        {
            if (ModelState.IsValid)
            {
                db.Entry(kargo).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(kargo));
        }
コード例 #8
0
        public ActionResult Create([Bind(Include = "KargoID,KargoAdi,KargoResmi")] Kargo kargo)
        {
            if (ModelState.IsValid)
            {
                db.Kargo.Add(kargo);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(kargo));
        }
        public async Task <ActionResult> Create([Bind(Include = "Id,KargoAdi")] Kargo kargo)
        {
            if (ModelState.IsValid)
            {
                db.Kargoes.Add(kargo);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(kargo));
        }
コード例 #10
0
        public ActionResult KargoGuncelle(Kargo guncelKargo)
        {
            var kargo = db.Kargo.Find(guncelKargo.Id);

            kargo.Kurye_Id   = guncelKargo.Kurye_Id;
            kargo.Musteri_Id = guncelKargo.Musteri_Id;
            kargo.Agirlik    = guncelKargo.Agirlik;
            kargo.Boyut      = guncelKargo.Boyut;
            kargo.Tur        = guncelKargo.Tur;
            kargo.Fiyat      = guncelKargo.Fiyat;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #11
0
        public string Guncelle(int id, string ad, string Telno1, string Aciklama1)
        {
            Kargo p = m.Kargo.FirstOrDefault(x => x.KargoID == id);

            p.kargoadi = ad;
            p.telno    = Telno1;
            p.adres    = Aciklama1;

            m.SaveChanges();


            return("guncellendi");
        }
コード例 #12
0
        // GET: Admin/Kargoes/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Kargo kargo = db.Kargo.Find(id);

            if (kargo == null)
            {
                return(HttpNotFound());
            }
            return(View(kargo));
        }
        // GET: Admin/Kargo/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Kargo kargo = await db.Kargoes.FindAsync(id);

            if (kargo == null)
            {
                return(HttpNotFound());
            }
            return(View(kargo));
        }
コード例 #14
0
        public string Sil(int id)
        {
            Kargo k = m.Kargo.FirstOrDefault(x => x.KargoID == id);

            m.Kargo.Remove(k);
            try
            {
                m.SaveChanges();
                return("başarılı");
            }
            catch (Exception)
            {
                return("hata");
            }
        }
コード例 #15
0
ファイル: KargoSec.aspx.cs プロジェクト: busrasayim/Okul
        protected void btn_Tamamla_Click(object sender, EventArgs e)
        {
            if (Request.Form["kargo"] != null)
            {
                Kargo  kargo   = new Kargo();
                string kargoID = Request.Form["kargo"].ToString();
                kargo = eticaretDB.Kargos.SingleOrDefault(k => k.KargoID == int.Parse(kargoID));
                int odenecekMiktar = int.Parse(Request.Cookies["odenecek"].Value) + int.Parse(kargo.KargoFiyat);
                Response.Cookies["kargoID"].Value   = kargoID;
                Response.Cookies["kargoID"].Expires = DateTime.Now.AddMinutes(30);
                Response.Cookies["odenecek"].Value  = odenecekMiktar.ToString();

                Response.Redirect(ResolveUrl("Odeme.aspx"));
            }
            else
            {
            }
        }
コード例 #16
0
ファイル: HomeController.cs プロジェクト: GYumurtac/KargoApi
        public HttpResponseMessage KargoOlustur(KargoVM item)
        {
            try
            {
                if (item != null)
                {
                    Alici alici = new Alici
                    {
                        FirstName  = item.Adi.TrimEnd(),
                        LastName   = item.Soyadi.TrimEnd(),
                        TCKimlikNo = item.TCKimlikNumarası
                    };

                    arep.Add(alici);

                    AdresBilgisi adresBilgisi = new AdresBilgisi
                    {
                        AliciID = alici.ID,
                        Adres   = item.Adres.TrimEnd(),
                        EPosta  = item.Mail.TrimEnd(),
                        Mahalle = item.Mahalle.TrimEnd(),
                        Ilce    = item.Ilce.TrimEnd(),
                        Sehir   = item.Il.TrimEnd(),
                        Telefon = item.Telefon.TrimEnd()
                    };

                    adrep.Add(adresBilgisi);

                    Kargo kargo = new Kargo
                    {
                        AliciID = alici.ID
                    };

                    krep.Add(kargo);

                    return(Request.CreateResponse(HttpStatusCode.Created, $"Kargo Oluşturuldu/Takip Numarası : {kargo.GonderiNo} "));
                }
                return(Request.CreateResponse(HttpStatusCode.BadRequest, "Kargo Oluşturulamadı"));
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, ex));
            }
        }
コード例 #17
0
        public RedirectToRouteResult KargoEkle(Kargo kargo)
        {
            //if (!ModelState.IsValid)
            //{
            //    return RedirectToAction("KargoEkle");
            //}


            //var kargo = new Kargo();
            //kargo.Kurye_Id = kargoModel.KargoModel.Kurye_Id;
            //kargo.Musteri_Id = kargoModel.KargoModel.Musteri_Id;
            //kargo.Tur = kargoModel.KargoModel.Tur;
            //kargo.Agirlik = kargoModel.KargoModel.Agirlik;
            //kargo.Boyut = kargoModel.KargoModel.Boyut;
            //kargo.Fiyat = kargoModel.KargoModel.Fiyat;


            db.Kargo.Add(kargo);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #18
0
        public bool Delete(int entityID)
        {
            Kargo deleted = _kargoDAL.Get(a => a.KargoId == entityID);

            return(_kargoDAL.Delete(deleted) > 0);
        }
コード例 #19
0
 public ActionResult Ekle(Kargo y)
 {
     m.Kargo.Add(y);
     m.SaveChanges();
     return(RedirectToAction("Index"));
 }
コード例 #20
0
 public void Add(Kargo entity)
 {
     _kargoManagement.Add(entity);
 }
コード例 #21
0
 public void Delete(Kargo entity)
 {
     _kargoManagement.Delete(entity);
 }
コード例 #22
0
 public void Update(Kargo entity)
 {
     _kargoManagement.Update(entity);
 }
コード例 #23
0
 public override void Gonder()
 {
     Kargo.KargoGonder(Gonderen, Alici, anlasmaliFiyat, Aciklama);
 }
コード例 #24
0
 public bool Update(Kargo entity)
 {
     return(_kargoDAL.Update(entity) > 0);
 }
コード例 #25
0
 public bool Add(Kargo entity)
 {
     return(_kargoDAL.Add(entity) > 0);
 }