Beispiel #1
0
        public JsonResult AddProductOptions(int?id, string dizi)
        {
            try
            {
                ProductSpesification ps = new ProductSpesification();
                Product pro             = _productBll.GetOne(x => x.Id == id);
                if (pro != null)
                {
                    string[] kes = dizi.Split('-');

                    if (kes.Length > 0)
                    {
                        for (int i = 0; i < ((kes.Length - 1) / 2); i += 2)
                        {
                            if (kes[i].Trim() != "")
                            {
                                ps.ProductId      = pro.Id;
                                ps.SpeCaption     = kes[i];
                                ps.SpeDescription = kes[i + 1];
                                _productSpesificationBll.Add(ps);
                            }
                        }
                    }

                    return(Json("success", JsonRequestBehavior.AllowGet));
                }

                return(Json("error", JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                return(Json(e.Message));
            }
        }
Beispiel #2
0
        public bool Add(ProductSpesification productSpesification)
        {
            bool result = _productSpesificationDal.Add(productSpesification);

            if (result)
            {
                return(true);
            }

            return(false);
        }