public ActionResult Create(List <arthaBudget> arthabudget, FormCollection col)
        {
            DateTime nepDate;
            int      mn   = Convert.ToInt32(col["month"]);
            int      fyId = Convert.ToInt32(col["fyId"]);
            //var objFiscalYear = db.fisYears.Find(fyId);
            string year = getYear(fyId, mn);

            nepDate = Convert.ToDateTime(col["nepDate"]);
            var objArtha = db.arthaBudgets.FirstOrDefault(m => (m.year == year) && (m.monthIndex == mn));

            if (ModelState.IsValid)
            {
                foreach (var item in arthabudget)
                {
                    arthaBudget artha = new arthaBudget();
                    artha.employeeName = TrimText(item.employeeName);
                    artha.khaSiNa3     = item.khaSiNa3;
                    artha.khaSiNa4     = item.khaSiNa4;
                    artha.nepDate      = nepDate;
                    artha.year         = year;
                    artha.month        = ((month)mn).ToString();
                    artha.monthIndex   = mn;
                    artha.fyId         = Convert.ToInt32(col["fyId"]);
                    db.arthaBudgets.Add(artha);
                }
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.ErrorMessage = "Record Not Inserted.Please Try Again";
            ViewBag.fyId         = new SelectList(db.fisYears, "fyId", "nepFy", fyId);
            return(View(arthabudget));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            arthaBudget arthabudget = db.arthaBudgets.Find(id);

            db.arthaBudgets.Remove(arthabudget);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        // GET: /ArthaBudget/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            arthaBudget arthabudget = db.arthaBudgets.Find(id);

            if (arthabudget == null)
            {
                return(HttpNotFound());
            }
            return(View(arthabudget));
        }
        // GET: /ArthaBudget/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            arthaBudget arthabudget = db.arthaBudgets.Find(id);

            if (arthabudget == null)
            {
                return(HttpNotFound());
            }
            // var objListArtha = db.arthaBudgets.Where(m => m.fyId == arthabudget.fyId && m.monthIndex == arthabudget.monthIndex).ToList();
            ViewBag.fyId = new SelectList(db.fisYears, "fyId", "nepFy", arthabudget.fyId);
            return(View(arthabudget));
            // return View(objListArtha);
        }
 public ActionResult Edit(arthaBudget arthabudget)
 {
     if (ModelState.IsValid)
     {
         string year     = getYear(arthabudget.fyId, arthabudget.monthIndex);
         var    objArtha = db.arthaBudgets.Find(arthabudget.arthaBudgetId);
         objArtha.employeeName = TrimText(arthabudget.employeeName);
         objArtha.khaSiNa3     = arthabudget.khaSiNa3;
         objArtha.khaSiNa4     = arthabudget.khaSiNa4;
         objArtha.monthIndex   = arthabudget.monthIndex;
         objArtha.year         = year;
         objArtha.month        = ((month)arthabudget.monthIndex).ToString();
         objArtha.nepDate      = arthabudget.nepDate;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.fyId = new SelectList(db.fisYears, "fyId", "nepFy", arthabudget.fyId);
     return(View(arthabudget));
 }