예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Sellproduct sellproduct = db.Sellproducts.Find(id);

            db.Sellproducts.Remove(sellproduct);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
 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));
 }
예제 #3
0
        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));
        }
예제 #4
0
        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));
        }
예제 #5
0
 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));
 }