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

            if (id != -1)
            {
                var svc = new GeneralStateAppService();
                var o = svc.GetGeneralState(id);
                model.GeneralStateId = o.GeneralStateId;
                model.Name = o.Name;
            

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



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



            try
            {
                var svc = new GeneralStateAppService();

                var o = new GeneralState
                {
                    GeneralStateId= model.GeneralStateId,
                    Name = model.Name,
                    

                };

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

                        svc.SaveGeneralState(o);
                    }
                    else
                    {
                        svc.RemoveGeneralState(model.GeneralStateId);
                    }
                    ViewBag.Feed = 0;
                }
            }
            catch (Exception)
            {
                ViewBag.Feed = 1;

            }

            return View(model);
        }