public ActionResult Add(string key) { var model = new DN_Packet(); try { if (key != Keyapi) { return(Json(0, JsonRequestBehavior.AllowGet)); } UpdateModel(model); model.Name = HttpUtility.UrlDecode(model.Name); //var lstP = Request["LstProductID"]; var lstB = Request["BedDeskID"]; //model.Shop_Product = _da.GetListProduct(FDIUtils.StringToListInt(lstP)); model.DN_Bed_Desk = _da.GetListBeDesk(FDIUtils.StringToListInt(lstB)); var packetproduct = new List <DN_Product_Packet>(); var stt = ConvertUtil.ToInt32(Request["do_stt"]); for (var i = 1; i <= stt; i++) { var a = Request["Default_" + i]; var b = Request["Price_" + i]; var c = Request["Obj_" + i]; if (!string.IsNullOrEmpty(c)) { var obj = new DN_Product_Packet { ProductId = ConvertUtil.ToInt32(Request["Obj_" + i] ?? "0"), IsDefault = !string.IsNullOrEmpty(a) }; packetproduct.Add(obj); //total += obj.Price ?? 0; } } model.DN_Product_Packet = packetproduct; _da.Add(model); _da.Save(); return(Json(model.ID, JsonRequestBehavior.AllowGet)); } catch (Exception) { return(Json(0, JsonRequestBehavior.AllowGet)); } }
public void Delete(DN_Packet item) { FDIDB.DN_Packet.Remove(item); }
public void Add(DN_Packet item) { FDIDB.DN_Packet.Add(item); }