public JsonResult EditReason(int ReasonID, string ReasonName, Reason reason1)
        {
            string _Edit = null;

            if (reason.CheckReason(ReasonID, ReasonName))
            {
                if (reason.Save(reason1))
                {
                    _Edit = "Reason Edited Successfully";
                }
            }
            else
            {
                _Edit = "Reason Already Exist's";
            }
            return(new JsonResult {
                Data = _Edit, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
        public ActionResult Reason(Reason obj, FormCollection fc)

        {
            try
            {
                BL_Reason Bl_reason = new BL_Reason();
                if (Bl_reason.CheckReason(obj.ReasonID, obj.ReasonName))
                {
                    if (Bl_reason.Save(obj))
                    {
                        if (obj.ReasonID > 0)
                        {
                            TempData["Msg"] = "Reason Update Successfully";
                            return(RedirectToAction("Reason", "Reason"));
                        }
                        else
                        {
                            TempData["Msg"] = "Reason Saved Successfully";
                            return(RedirectToAction("Reason", "Reason"));
                        }
                    }
                }
                else
                {
                    //TempData["Msg"] = "Error";
                    TempData["Msg"] = "Reason Already Exist's";
                    return(RedirectToAction("Reason", "Reason"));
                }

                return(RedirectToAction("Reason", "Reason"));
            }
            catch (Exception ex)
            {
                TempData["Msg"] = ex.Message;
                return(RedirectToAction("Reason", "Reason"));
            }
        }