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

            if (id != -1)
            {
                var svc = new BodyPartAppService();
                var o = svc.GetBodyPart(id);
                model.BodyPartId = o.BodyPartId;
                model.Name = o.Name;
            

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



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



            try
            {
                var svc = new BodyPartAppService();

                var o = new BodyPart
                {
                    BodyPartId= model.BodyPartId,
                    Name = model.Name,
                    

                };

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

                        svc.SaveBodyPart(o);
                    }
                    else
                    {
                        svc.RemoveBodyPart(model.BodyPartId);
                    }
                    ViewBag.Feed = 0;
                }
            }
            catch (Exception)
            {
                ViewBag.Feed = 1;

            }

            return View(model);
        }