public ActionResult DeleteConfirmed(string id) { ts_stock ts_stock = db.ts_stock.Find(id); db.ts_stock.Remove(ts_stock); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "last_manual_count,last_auto_count,qty,sku,ictag")] ts_stock ts_stock) { if (ModelState.IsValid) { db.Entry(ts_stock).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(ts_stock)); }
public ActionResult Create([Bind(Include = "last_manual_count,last_auto_count,qty,sku,ictag")] ts_stock ts_stock) { if (ModelState.IsValid) { db.ts_stock.Add(ts_stock); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(ts_stock)); }
//add ts stock from production public JsonResult ts_add_stock(string[] asset) { string message = ""; string current_asset = ""; //format the tsg sku to the ss format // channel = channel.Replace("TSG_", "HW-"); for (int i = 0; i < asset.Length; i++) { string temp_asset = asset[i]; var db = new db_a094d4_icdbEntities1(); var exisit = (from t in db.ts_stock where t.ictag == temp_asset select t).FirstOrDefault(); if (exisit == null) { int int_asset = int.Parse(temp_asset); var channel = (from t in db.rediscovery where t.ictag == int_asset select t.pallet).FirstOrDefault(); if (!channel.Contains("TSG_")) { message += "<p style='color:red'>" + asset[i] + " has a non-TechSoup SKU</p>"; continue; } channel = channel.Replace("TSG_", "HW-"); ts_stock ts = new ts_stock(); ts.ictag = temp_asset; current_asset = temp_asset; ts.sku = channel; ts.status = "Ready_for_Shipping"; db.ts_stock.Add(ts); db.SaveChanges(); message += "<p style='color:green'>" + asset[i] + " Sucessfully Added to " + channel + "</p>"; } else { message += "<p style='color:red'>" + asset[i] + " Failed to Import (possible duplicate entry)</p>"; } } db.Dispose(); return(Json(message, JsonRequestBehavior.AllowGet)); }
// GET: ts_stock/Delete/5 public ActionResult Delete(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ts_stock ts_stock = db.ts_stock.Find(id); if (ts_stock == null) { return(HttpNotFound()); } return(View(ts_stock)); }
public JsonResult remove_ts_stock(string asset, string sku) { string message = ""; try { var ts_stock = new ts_stock { ictag = asset }; db.ts_stock.Attach(ts_stock); db.ts_stock.Remove(ts_stock); db.SaveChanges(); message = "Asset " + asset + " Removed"; } catch (Exception e) { message = "Error"; } return(Json(message, JsonRequestBehavior.AllowGet)); }