public ActionResult Active(string key, Guid userId)
        {
            var msg = new JsonMessage(false, "Update dữ liệu thành công !");

            try
            {
                if (key == Keyapi)
                {
                    var lst    = Request["ItemID"].Split(',');
                    var id     = int.Parse(lst[0] ?? "0");
                    var cateId = int.Parse(lst[1] ?? "0");
                    var model  = _da.GetListByCateId(cateId);
                    foreach (var item in model)
                    {
                        item.IsUse = false;
                        if (id == item.ID)
                        {
                            item.IsUse      = true;
                            item.DateUpdate = DateTime.Now.TotalSeconds();
                            item.UserId     = userId;

                            decimal?cost       = 0;
                            decimal?priceFinal = 0;
                            foreach (var items in item.Category_Product_Recipe.Where(c => c.IsCheck == true && (!c.IsDeleted.HasValue || c.IsDeleted == false)))
                            {
                                var temp = _detailDa.GetById(items.ProductId ?? 0);
                                cost          += items.Price * items.Quantity;
                                priceFinal    += items.Price == 0 ? 0 : (items.Price + temp.Category.Percent * 1000) * items.Quantity + items.Incurred;
                                temp.PriceCost = items.Price;
                                temp.Value     = items.Price;
                                temp.Percent   = temp.Category.Percent;
                                temp.PriceOld  = items.Price + (temp.Incurred ?? 0) + (temp.Percent ?? 0) * 1000;
                                temp.Incurred  = items.Incurred;
                                temp.Price     = items.PriceProduct;
                                _detailDa.Save();
                            }

                            foreach (var items in item.Mapping_Category_Recipe.Where(c => c.IsCheck == true && (!c.IsDeleted.HasValue || c.IsDeleted == false)))
                            {
                                //var temp = _detailDa.GetById(model.CategoryID ?? 0);

                                //priceFinal += items.PriceProduct * items.Quantity;
                                //temp.Price = items.PriceProduct;
                                //temp.PriceCost = items.Price;
                                //temp.Incurred = items.Incurred;
                                //temp.Price = items.PriceProduct;
                                //temp.Value = items.Price;
                                //temp.PriceOld = items.Price + (temp.Incurred ?? 0) + (temp.Percent ?? 0) * 1000;
                                //_detailDa.Save();
                                var temp1 = _categoryDa.GetById(item.CategoryID ?? 0);
                                cost                  += items.Price;
                                priceFinal            += items.Price + (temp1.Percent * 1000 * items.Quantity) + items.Incurred;
                                temp1.PriceRecipeFinal = items.Price + (items.Quantity * temp1.Percent * 1000) + items.Incurred;
                                _detailDa.Save();
                            }
                            var cate = _categoryDa.GetById(item.CategoryID ?? 0);
                            cate.PriceRecipe        = cost;
                            cate.PriceRecipeFinal   = priceFinal;
                            cate.TotalIncurredFinal = item.TotalIncurred;
                            _categoryDa.Save();
                        }
                    }
                    _da.Save();
                }
            }
            catch (Exception ex)
            {
                msg.Erros   = true;
                msg.Message = "Dữ liệu chưa được Update.";
            }
            return(Json(msg, JsonRequestBehavior.AllowGet));
        }