コード例 #1
0
        //[Authorize(Roles = "Ngo")]
        public ActionResult Create(VoluntaryAction V)
        {
            VoluntaryAction v = new VoluntaryAction();

            //try
            //{
            v.Name          = V.Name;
            v.Address       = V.Address;
            v.Description   = V.Description;
            v.StartDate     = V.StartDate;
            v.EndDate       = V.EndDate;
            v.MaxVolunteers = V.MaxVolunteers;
            v.ActionType    = V.ActionType;
            v.CreatorNgoId  = User.Identity.GetUserId();
            vas.Add(v);
            vas.Commit();


            return(RedirectToAction("Index"));
            //}
            //catch
            //{
            //    return View();
            //}
        }
コード例 #2
0
        public ActionResult Edit(int id, VoluntaryAction V)
        {
            VoluntaryAction action = new VoluntaryAction();

            action = vas.GetById(V.ActionId);

            try
            {
                action.Name          = V.Name;
                action.Address       = V.Address;
                action.Description   = V.Description;
                action.StartDate     = V.StartDate;
                action.EndDate       = V.EndDate;
                action.MaxVolunteers = V.MaxVolunteers;
                action.ActionType    = V.ActionType;
                vas.Commit();
                //return View();
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
コード例 #3
0
 //[Authorize(Roles = "Ngo")]
 public ActionResult Delete(int id, VoluntaryAction V)
 {
     return(View());
 }