// GET: Musteri public ActionResult Index() { using (var context = new MvcStokDbEntities()) { var model = context.Musteriler.ToList(); if (model != null) { return(View(model)); } return(HttpNotFound()); } }
public ActionResult KategoriFormu(int id = 0) { using (var context = new MvcStokDbEntities()) { var result = context.Kategoriler.Find(id); if (result != null) { return View("KategoriFormu",result); } return HttpNotFound(); } }
public ActionResult MusteriFormu(int id = 0) { using (var context = new MvcStokDbEntities()) { var result = context.Musteriler.Find(id); if (result != null) { return(View("MusteriFormu", result)); } return(HttpNotFound()); } }
// GET: Urun public ActionResult Index() { using (var context = new MvcStokDbEntities()) { var model = context.Urunler.Include("Kategoriler").ToList(); if (model != null) { return(View(model)); } return(HttpNotFound()); } }
// GET: Kategori public ActionResult Index(int page=1) { using (var context = new MvcStokDbEntities()) { var model = context.Kategoriler.ToList().ToPagedList(page, 3); if (model != null) { return View(model); } return HttpNotFound(); } }
public ActionResult SatisYap(Satislar satis) { using (var context = new MvcStokDbEntities()) { if (satis != null) { context.Satislar.Add(satis); context.SaveChanges(); return(RedirectToAction("Index")); } return(View()); } }
public ActionResult Sil(int id = 0) { using (var context = new MvcStokDbEntities()) { var result = context.Musteriler.Find(id); if (result != null) { context.Musteriler.Remove(result); context.SaveChanges(); return(RedirectToAction("Index")); } return(HttpNotFound()); } }
public ActionResult Guncelle(Kategoriler kategori) { using (var context = new MvcStokDbEntities()) { var result = context.Kategoriler.Find(kategori.İd); if (result != null) { result.KategoriAdi = kategori.KategoriAdi; context.SaveChanges(); return RedirectToAction("Index"); } return HttpNotFound(); } }
public ActionResult Guncelle(Musteriler musteri) { using (var context = new MvcStokDbEntities()) { var result = context.Musteriler.Find(musteri.İd); if (result != null) { result.MusteriAdi = musteri.MusteriAdi; result.MusteriSoyad = musteri.MusteriSoyad; context.SaveChanges(); return(RedirectToAction("Index")); } return(HttpNotFound()); } }
public ActionResult Ekle(Urunler urun) { using (var context = new MvcStokDbEntities()) { if (urun != null) { var kategori = context.Kategoriler.Where(m => m.İd == urun.Kategoriler.İd).FirstOrDefault(); urun.Kategoriler = kategori; context.Urunler.Add(urun); context.SaveChanges(); return(RedirectToAction("Index")); } return(HttpNotFound()); } }
public ActionResult Ekle() { using (var context = new MvcStokDbEntities()) { List <SelectListItem> result = (from i in context.Kategoriler.Where(c => c.Status == true).ToList() select new SelectListItem { Text = i.KategoriAdi, Value = i.İd.ToString() }).ToList(); ViewBag.res = result; } return(View()); }
public ActionResult Sil(int id=0) { using (var context = new MvcStokDbEntities()) { var kategori = context.Kategoriler.Find(id); if (kategori != null) { kategori.Status = false; context.SaveChanges(); return RedirectToAction("Index"); } return HttpNotFound(); } }
public ActionResult Ekle(Musteriler musteri) { using (var context = new MvcStokDbEntities()) { if (ModelState.IsValid) { if (musteri != null) { context.Musteriler.Add(musteri); context.SaveChanges(); return(RedirectToAction("Index")); } } return(View()); } }
public ActionResult Ekle(Kategoriler kategori) { using (var context = new MvcStokDbEntities()) { if (ModelState.IsValid) { if (kategori != null) { context.Kategoriler.Add(kategori); context.SaveChanges(); return RedirectToAction("Index"); } } return View(); } }
public ActionResult Guncelle(Urunler urun) { using (var context = new MvcStokDbEntities()) { var result = context.Urunler.Find(urun.İd); if (result != null) { result.UrunAdi = urun.UrunAdi; result.Marka = urun.Marka; result.Stok = urun.Stok; result.Fiyat = urun.Fiyat; var kategori = context.Kategoriler.Where(m => m.İd == urun.Kategoriler.İd).FirstOrDefault(); result.KategoriId = kategori.İd; context.SaveChanges(); return(RedirectToAction("Index")); } return(HttpNotFound()); } }
public ActionResult UrunFormu(int id = 0) { using (var context = new MvcStokDbEntities()) { var result = context.Urunler.Find(id); if (result != null) { List <SelectListItem> items = (from i in context.Kategoriler.ToList() select new SelectListItem { Text = i.KategoriAdi, Value = i.İd.ToString() }).ToList(); ViewBag.res = items; return(View("UrunFormu", result)); } return(HttpNotFound()); } }