public ActionResult Create([Bind(Include = "A2AAllocatedBudgetId,Year,BeginingBalance")] A2AAllocatedBudget a2AAllocatedBudget)
        {
            if (ModelState.IsValid)
            {
                var dataexist = from s in db.AFLAllocation
                                where
                                s.Year == a2AAllocatedBudget.Year
                                select s;

                if (dataexist.Count() >= 1)
                {
                    ViewBag.error = "Allocation Budget for " + a2AAllocatedBudget.Year
                                    + " already exists.";

                    ModelState.Clear();
                }
                else
                {
                    a2AAllocatedBudget.A2AAllocatedBudgetId = Guid.NewGuid();
                    db.AFLAllocation.Add(a2AAllocatedBudget);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
            }
            var datelist = Enumerable.Range(System.DateTime.Now.Year - 1, 5).ToList();

            ViewBag.Year = new SelectList(datelist);
            return(View(a2AAllocatedBudget));
        }
        public ActionResult DeleteConfirmed(Guid id)
        {
            A2AAllocatedBudget a2AAllocatedBudget = db.AFLAllocation.Find(id);

            db.AFLAllocation.Remove(a2AAllocatedBudget);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "A2AAllocatedBudgetId,Year,BeginingBalance")] A2AAllocatedBudget a2AAllocatedBudget)
 {
     if (ModelState.IsValid)
     {
         db.Entry(a2AAllocatedBudget).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(a2AAllocatedBudget));
 }
        // GET: A2AAllocatedBudget/Edit/5
        public ActionResult Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            A2AAllocatedBudget a2AAllocatedBudget = db.AFLAllocation.Find(id);

            if (a2AAllocatedBudget == null)
            {
                return(HttpNotFound());
            }
            return(View(a2AAllocatedBudget));
        }