Пример #1
0
 public string _ValueCreatePopup(SpecificationAttributeValueViewModel model)
 {
     if (ModelState.IsValid)
     {
         SpecificationAttributeValue _spec = new SpecificationAttributeValue();
         _spec.Name    = model.Name;
         _spec.OrderNo = model.OrderNo;
         _spec.SpecificationAttributeId = model.SpecificationAttributeId;
         if (model.ValueId > 0)
         {
             _spec.Id = model.ValueId;
             if (_specificationValueService.Update(_spec))
             {
                 return("1");
             }
             else
             {
                 return("-1");
             }
         }
         else
         {
             if (_specificationValueService.Insert(_spec) != null)
             {
                 return("1");
             }
             else
             {
                 return("-1");
             }
         }
     }
     return("-1");
 }
Пример #2
0
        public PartialViewResult _ValueCreatePopup(int Id)
        {
            var model = new SpecificationAttributeValueViewModel();

            model.SpecificationAttributeId = Id;

            return(PartialView(model));
        }
Пример #3
0
        //[HttpPost]
        //[ValidateAntiForgeryToken]
        //public string _ValueEditePopup(SpecificationAttributeValueViewModel model)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        SpecificationAttributeValue _spec = new SpecificationAttributeValue();
        //        _spec.Id = model.ValueId;
        //        _spec.Name = model.Name;
        //        _spec.OrderNo = model.OrderNo;
        //        _spec.SpecificationAttributeId = model.SpecificationAttributeId;
        //        if (_specificationValueService.Update(_spec))
        //        {
        //            return "1";
        //        }

        //        else
        //        {

        //            return "-1";
        //        }
        //    }
        //    return "-1";
        //}
        public ActionResult GetValueByAttributeId(int Id)
        {
            var data  = _specificationValueService.GetById(Id);
            var model = new SpecificationAttributeValueViewModel();

            if (data != null)
            {
                model.ValueId = data.Id;
                model.Name    = data.Name;
                model.OrderNo = data.OrderNo;
                model.SpecificationAttributeId = data.SpecificationAttributeId;
            }
            return(Json(model, JsonRequestBehavior.AllowGet));
        }