/// <summary>
        /// Edits the specified identifier.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <returns>ActionResult.</returns>
        public ActionResult Edit(int id)
        {
            var model = new DrugSubCategoryViewModel();
            model.Categories = HealthHelper.GetAllDrugCategories();
            if (id != -1)
            {
                var svc = new DrugSubCategoryAppService();
                var o = svc.GetDrugSubCategory(id);
                model.DrugSubCategoryId = o.DrugSubCategoryId;
                model.Name = o.Name;
                model.DrugCategoryId = o.DrugCategoryId;

            }
            else
            {
                model.Action = "-1";
                model.DrugSubCategoryId = -1;
                model.Name = string.Empty;
                
            }



            return View(model);
        }
        public ActionResult Edit(DrugSubCategoryViewModel model)
        {



            try
            {
                var svc = new DrugSubCategoryAppService();
                model.Categories = HealthHelper.GetAllDrugCategories();
                var o = new DrugSubCategory
                {
                    DrugSubCategoryId= model.DrugSubCategoryId,
                    Name = model.Name,
                    DrugCategoryId = model.DrugCategoryId

                };

                if (model.Action == "-1")
                {
                    var exist = svc.GetDrugSubCategory(model.DrugSubCategoryId)!=null;
                    if (!exist)
                    {
                        svc.AddDrugSubCategory(o);
                        ViewBag.Feed = 0;
                    }
                    else
                    {
                        model.Action = "-1";
                        ViewBag.Feed = 3;
                        return View(model);
                    }
                }
                else
                {
                    o.DrugSubCategoryId= model.DrugSubCategoryId;
                    if (model.IsDeleteAction == 0)
                    {

                        svc.SaveDrugSubCategory(o);
                    }
                    else
                    {
                        svc.RemoveDrugSubCategory(model.DrugSubCategoryId);
                    }
                    ViewBag.Feed = 0;
                }
            }
            catch (Exception)
            {
                ViewBag.Feed = 1;

            }

            return View(model);
        }