Beispiel #1
0
        public SiparisYeni SiparisDuzenle(SiparisYeni model, int?id)
        {
            Sipari siparis = _uow.GetRepository <Sipari>().GetById(Convert.ToInt32(id));

            siparis.UrunId      = model.Siparis.UrunId;
            siparis.MusteriId   = model.Siparis.MusteriId;
            siparis.SiparisAdet = model.Siparis.SiparisAdet;
            //siparis.SiparisTarihi = model.Siparis.SiparisTarihi;
            siparis.EklenmeTarihi = DateTime.Now;
            siparis.SiparisDurum  = model.Siparis.SiparisDurum;

            _uow.GetRepository <Sipari>().Update(siparis);
            _uow.SaveChanges();

            model         = GetSelectedModel(id);
            model.Siparis = siparis;
            return(model);
        }
Beispiel #2
0
        public SiparisYeni GetModel()
        {
            SiparisYeni models = new SiparisYeni();

            models.Siparis = new Sipari();

            List <SelectListItem> urunListItem = new List <SelectListItem>();

            foreach (var item in _uow.GetRepository <Urun>().GetAll().ToList())
            {
                urunListItem.Add(new SelectListItem
                {
                    Text  = item.UrunAdi.ToString(),
                    Value = item.Id.ToString()
                });
            }
            models.urunListItem = urunListItem;

            List <SelectListItem> musteriListItem = new List <SelectListItem>();

            foreach (var item in _uow.GetRepository <Musteri>().GetAll().ToList())
            {
                musteriListItem.Add(new SelectListItem
                {
                    Text  = item.MusteriAdiSoyadi.ToString(),
                    Value = item.Id.ToString()
                });
            }
            models.musteriListItem = musteriListItem;

            List <SelectListItem> siparisDurumListItem = new List <SelectListItem>();

            foreach (var item in _uow.GetRepository <SiparisDurum>().GetAll().ToList())
            {
                siparisDurumListItem.Add(new SelectListItem
                {
                    Text  = item.Durum.ToString(),
                    Value = item.Id.ToString()
                });
            }
            models.siparisDurumListItem = siparisDurumListItem;

            return(models);
        }
Beispiel #3
0
        public ActionResult Yeni(SiparisYeni model)
        {
            Sipari siparis = new Sipari();

            siparis.UrunId        = model.Siparis.UrunId;
            siparis.MusteriId     = model.Siparis.MusteriId;
            siparis.SiparisAdet   = model.Siparis.SiparisAdet;
            siparis.SiparisDurum  = model.Siparis.SiparisDurum;
            siparis.EklenmeTarihi = DateTime.Now;
            siparis.SiparisTarihi = DateTime.Now;

            _uow.GetRepository <Sipari>().Add(siparis);
            _uow.SaveChanges();

            model         = GetModel();
            model.Siparis = _uow.GetRepository <Sipari>().GetAll().OrderByDescending(x => x.SiparisId).FirstOrDefault();

            return(View(model));
        }
Beispiel #4
0
 public ActionResult Duzenle(SiparisYeni model, int?id)
 {
     return(View(SiparisDuzenle(model, id)));
 }