public JsonResult write_RetailDymo(int asset_tag, double price, string manu, string cpu, string ram, string hdd, string sku) { var existing = (from im in db.retail where im.asset_tag.Equals(asset_tag) select im).SingleOrDefault(); if (existing != null) { existing.sold = "NO"; existing.price = price; db.SaveChanges(); } else { var create_dymo = new retail(); create_dymo.time = DateTime.Today; create_dymo.custom_label = "NO"; create_dymo.sold = "NO"; create_dymo.asset_tag = asset_tag; create_dymo.model = manu; create_dymo.cpu = cpu; create_dymo.ram = ram; create_dymo.hdd = hdd; create_dymo.price = price; db.retail.Add(create_dymo); db.SaveChanges(); db.Dispose(); } //update price to magento system after price label have printed out string price_str = price.ToString(); mage mage = new mage(); bool success = mage.update_price(sku, price_str); return(Json(new { success = success }, JsonRequestBehavior.AllowGet)); }