public ActionResult EditDeptAmount(DeptAmountViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    DbfunctionUtility dbfunction = new DbfunctionUtility(_appSettings);
                    var     query = "select * from deptamount where Dept = '" + model.Dept + "'  and   deptamount_id != '" + model.deptamount_id + "'  ";
                    DataSet ds    = dbfunction.GetDataset(query);
                    if (ds.Tables[0].Rows.Count == 0)
                    {
                        query = " update deptamount set   Dept = '" + model.Dept + "', Amount = " + model.Amount + "   where  deptamount_id = '" + model.deptamount_id + "';";
                        ds    = dbfunction.GetDataset(query);
                        ViewBag.SuccessMessage = "Department amount detail updated successfully";
                    }
                    else
                    {
                        ViewBag.ErrorMessage = "Department amount detail is already exists";
                    }
                }
            }
            catch (Exception ex)
            {
            }

            return(View(model));
        }
        public ActionResult EditDeptAmount(string id)
        {
            DeptAmountViewModel model = new DeptAmountViewModel();

            try
            {
                if (ModelState.IsValid)
                {
                    DbfunctionUtility dbfunction = new DbfunctionUtility(_appSettings);
                    DataSet           ds         = dbfunction.GetDataset("select * from deptamount where deptamount_id= " + id + ";");

                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        model.Dept          = Convert.ToString(ds.Tables[0].Rows[0]["Dept"]);
                        model.Amount        = Convert.ToDecimal(ds.Tables[0].Rows[0]["Amount"]);
                        model.deptamount_id = Convert.ToInt32(id);
                    }
                    else
                    {
                        return(RedirectToAction("DeptAmountList", "DataEntry"));
                    }
                }
            }
            catch (Exception ex)
            {
            }

            return(View(model));
        }