public ActionResult DeleteConfirmed(int id) { Sellproduct sellproduct = db.Sellproducts.Find(id); db.Sellproducts.Remove(sellproduct); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,SName,SBrand,SModel,Description,SNumber,Stock,Price")] Sellproduct sellproduct) { if (ModelState.IsValid) { db.Entry(sellproduct).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(sellproduct)); }
public ActionResult Sell(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Sellproduct sellproduct = db.Sellproducts.Find(id); if (sellproduct == null) { return(HttpNotFound()); } return(View(sellproduct)); }
public ActionResult Create([Bind(Include = "Id,SName,SBrand,SModel,Description,SNumber,Stock,Price")] Sellproduct sellproduct) { if (ModelState.IsValid) { db.Sellproducts.Add(sellproduct); db.SaveChanges(); TechnicalServiceLog TSLog = new TechnicalServiceLog() { LogWho = User.Identity.Name, LogDescription = "Ürün ekledi", LogDatetime = DateTime.Now.ToLocalTime(), }; db.TSLogs.Add(TSLog); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(sellproduct)); }
public ActionResult Sell(Sellproduct sellproduct) { if (ModelState.IsValid) { if (sellproduct.Stock <= 0) { return(RedirectToAction("Index")); } else { Sellproduct product = db.Sellproducts.Find(sellproduct.Id); product.Stock = (product.Stock) - (sellproduct.SNumber); product.SNumber = 0; db.Entry(product).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } } return(View(sellproduct)); }