示例#1
0
        public ActionResult DeleteConfirmed(int id)
        {
            tbl_volunteer_application tbl_volunteer_application = db.tbl_volunteer_application.Find(id);

            db.tbl_volunteer_application.Remove(tbl_volunteer_application);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#2
0
 public ActionResult Edit([Bind(Include = "Id,full_name,age,gender,address,date")] tbl_volunteer_application tbl_volunteer_application)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tbl_volunteer_application).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tbl_volunteer_application));
 }
示例#3
0
        // GET: volunteer_application/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tbl_volunteer_application tbl_volunteer_application = db.tbl_volunteer_application.Find(id);

            if (tbl_volunteer_application == null)
            {
                return(HttpNotFound());
            }
            return(View(tbl_volunteer_application));
        }
示例#4
0
        public ActionResult Create([Bind(Include = "Id,full_name,age,gender,address,posting_id")] tbl_volunteer_application tbl_volunteer_application)
        {
            int    isAgreeFromForm = 0;
            string isAgree         = Request.Form.Get("Is_agree");

            if (isAgree == "on")
            {
                isAgreeFromForm = 1;
            }
            else
            {
                isAgreeFromForm = 0;
            }

            //            string test = Request.Form.Get("Is_agree");
            if (isAgreeFromForm == 0)
            {
                ModelState.AddModelError("Is_agree", "Please check the agreement");
            }
            else
            {
                if (ModelState.IsValid)
                {
                    tbl_volunteer_application.date     = DateTime.Now;
                    tbl_volunteer_application.Is_agree = Convert.ToByte(isAgreeFromForm);
                    db.tbl_volunteer_application.Add(tbl_volunteer_application);
                    db.SaveChanges();
                    return(RedirectToAction("thnakuser"));
                }
            }

            int postingId = Convert.ToInt32(Request.Form.Get("posting_id"));
            var posting   = db.tbl_volunteer_posting.Find(postingId);

            ViewBag.ApplicationId       = postingId;
            ViewBag.ApplicationPosition = posting.title;
            return(View(tbl_volunteer_application));
        }