コード例 #1
0
        public ActionResult Create(VolunteerVM volunteerVM)
        {
            try
            {
                if (TryValidateModel(volunteerVM.Volunteer))
                {
                    App.Db.Volunteers.Add(volunteerVM.Volunteer);
                    ViewBag.Email = volunteerVM.EmailAddress;
                    App.Db.SaveChanges();
                    Models.MailRepo repo = new MailRepo();
                    repo.SendVolunteerAcknowledgement(volunteerVM);
                    return View("Success");
                }
                else
                {
                    ViewBag.PossibleExperienceLevels = App.Db.ExperienceLevels;
                    return View(volunteerVM);
                }

            }
            catch (System.Data.Entity.Validation.DbEntityValidationException exceptio)
            {
                Elmah.ErrorSignal.FromCurrentContext().Raise(exceptio);
                ViewData.ModelState.AddModelError("unk","A data type error message prevent from saving your data.  Review your input form and try again.  Sorry, that's all I can tell you about the error.");
                return View(volunteerVM);
            }
            catch(Exception ex)
            {
                Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
                return View("Oops");
            }
        }
コード例 #2
0
        // Acquirer_Menu control_Menu = new Acquirer_Menu();
        public VolunteerPage()
        {
            InitializeComponent();
            acquirerId = (App.Current as App).UserId;
            vm         = new VolunteerVM(callback1, callback2, callback3);
            this.nagetive.Background = new ImageBrush()
            {
                ImageSource = new BitmapImage(new Uri("/Image_Acquirer/up.jpg", UriKind.Relative))
            };
            map.Children.Add(layer);

            btnSelect_area.IsHitTestVisible    = false;
            control_Category.image_OK.Tap     += new EventHandler <System.Windows.Input.GestureEventArgs>(image_Ok_Tap);
            control_Category.image_Cancel.Tap += new EventHandler <System.Windows.Input.GestureEventArgs>(image_Cancel_Tap);
            MenuContent.ManipulationDelta     += new EventHandler <ManipulationDeltaEventArgs>(MenuContent_ManipulationDelta);
            MenuContent.ManipulationCompleted += new EventHandler <ManipulationCompletedEventArgs>(MenuContent_ManipulationCompleted);
            control_Menu.menu_Yes.Tap         += new EventHandler <System.Windows.Input.GestureEventArgs>(menu_Yes_Tap);
            control_Menu.menu_no.Tap          += new EventHandler <System.Windows.Input.GestureEventArgs>(menu_no_Tap);
            Storyboard6.Completed             += new EventHandler(Storyboard6_Completed);
            callback1();
        }
コード例 #3
0
 public ActionResult Edit(VolunteerVM volunteerVM)
 {
     if (ModelState.IsValid)
     {
         App.Db.Entry(volunteerVM.Volunteer).State = EntityState.Modified;
         App.Db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.PossibleExperienceLevels = App.Db.ExperienceLevels;
     return View(volunteerVM);
 }