/// <summary>
        /// Edits the specified identifier.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <returns>ActionResult.</returns>
        public ActionResult Edit(int id)
        {
            var model = new DrugCategoryViewModel();

            if (id != -1)
            {
                var svc = new DrugCategoryAppService();
                var o = svc.GetDrugCategory(id);
                model.DrugCategoryId = o.DrugCategoryId;
                model.Name = o.Name;
            

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



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



            try
            {
                var svc = new DrugCategoryAppService();

                var o = new DrugCategory
                {
                    DrugCategoryId= model.DrugCategoryId,
                    Name = model.Name,
                    

                };

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

                        svc.SaveDrugCategory(o);
                    }
                    else
                    {
                        svc.RemoveDrugCategory(model.DrugCategoryId);
                    }
                    ViewBag.Feed = 0;
                }
            }
            catch (Exception)
            {
                ViewBag.Feed = 1;

            }

            return View(model);
        }