// GET: Order public String getOptionsValue(int optionID) { try { productRepository pr = new productRepository(new SSMEntities()); attributeOption opp = pr.getProductOption(optionID); optionInfo oi = new optionInfo(); oi.price = opp.price; oi.des = opp.description; JavaScriptSerializer serializer = new JavaScriptSerializer(); return(serializer.Serialize(oi)); } catch (Exception e) { } return(""); }
public JsonResult CreateNewOption(int attID, String optCode, String optname, String optdes, float optprice) { try { attributeOption opt = new attributeOption(); opt.attributeID = attID; opt.code = optCode; opt.name = optname; opt.price = optprice; opt.description = optdes; productRepository se = new productRepository(new SSMEntities()); se.insertNewOption(opt); return(Json(new { result = "true" }, JsonRequestBehavior.AllowGet)); } catch (Exception e) { } return(Json(new { result = "false" }, JsonRequestBehavior.AllowGet)); }
public void insertNewOption(attributeOption opt) { context.attributeOptions.Add(opt); context.SaveChanges(); }