Ejemplo n.º 1
0
 public ActionResult GetListSimpleProductDetail(string codec)
 {
     if (Request["key"] == Keyapi)
     {
         var obj = Cates.FirstOrDefault(m => m.Barcode == codec);
         if (obj == null)
         {
             var stt            = 1;
             var listItemDetail = _da.GetListSimpleProductDetail();
             foreach (var item in listItemDetail)
             {
                 item.Stt     = stt;
                 item.Barcode = FDIUtils.RandomCode(8);
                 item.Code    = "f" + stt;
                 stt++;
                 var objinew = new ImportProductAddItem
                 {
                     Stt      = 1,
                     BarCode  = FDIUtils.RandomCode(10),
                     Price    = item.Price,
                     Value    = 0,
                     PriceNew = 0,
                     Quantity = 1,
                 };
                 item.ListImportProductItems = new List <ImportProductAddItem> {
                     objinew
                 };
             }
             obj = new CateValueAddItem
             {
                 Stt      = 1,
                 Barcode  = codec,
                 PriceNew = 0,
                 Pi       = 0,
                 ListProductValueItems = listItemDetail,
             };
             Cates.Add(obj);
         }
         return(Json(obj, JsonRequestBehavior.AllowGet));
     }
     return(Json(new CateValueAddItem(), JsonRequestBehavior.AllowGet));
 }