Example #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Project project = new mongo().FindOne <Project>(p => p.Id == id);

            new mongo().Delete <Project>(new { Id = project.Id });
            return(RedirectToAction("Index"));
        }
Example #2
0
        public ActionResult Update(int?id)
        {
            var model = new mongo().FindOne <Rsvp>(i => i.Id == id);
            var vm    = new RsvpViewModel(model);

            return((vm != null) ? View("Index", vm) : View("Index"));
        }
Example #3
0
        public ActionResult List()
        {
            var rsvp = new mongo().GetCollection <Rsvp>().OrderByDescending(i => i.RespondedOn);
            var vm   = rsvp.Select(i => new RsvpViewModel(i));

            return(View("List", vm));
        }
Example #4
0
        public static Rsvp Retrieve(RsvpViewModel vm)
        {
            var item = new mongo().FindOne <Rsvp>(i => i.Id == vm.Id);

            item.Primary.Name        = vm.Primary.Name;
            item.Primary.IsAttending = new Guest(vm.Primary).IsAttending;
            item.PlusOne.Name        = vm.PlusOne.Name;
            item.PlusOne.IsAttending = new Guest(vm.PlusOne).IsAttending;
            item.Message             = vm.Message;
            return(item);
        }
Example #5
0
        public JsonResult Search(string term)
        {
            if (!String.IsNullOrEmpty(term))
            {
                var terms      = term.Split(new char[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries);
                var collection = new mongo().GetCollection <Rsvp>();
                var matches    = collection.Where(col => col.SearchTerms.Intersect(terms, new TermComparer()).Count() > 0);

                return(Json(matches.Select(i => new RsvpJsonModel(i)), JsonRequestBehavior.AllowGet));
            }
            return(Json(new { }, JsonRequestBehavior.AllowGet));
        }
 public ActionResult Add(int? id)
 {
     RsvpViewModel vm;
     if (id != null)
     {
         var m = new mongo().GetItemById<Rsvp>(id);
         vm = new RsvpViewModel(m);
     }
     else
     {
         vm = new RsvpViewModel();
         vm.Primary.IsEditable = true;
         vm.PlusOne.IsEditable = true;
     }
     return View("Add", vm);
 }
Example #7
0
        public ActionResult Add(int?id)
        {
            RsvpViewModel vm;

            if (id != null)
            {
                var m = new mongo().GetItemById <Rsvp>(id);
                vm = new RsvpViewModel(m);
            }
            else
            {
                vm = new RsvpViewModel();
                vm.Primary.IsEditable = true;
                vm.PlusOne.IsEditable = true;
            }
            return(View("Add", vm));
        }
 //
 // GET: /Projects/Details/5
 public ViewResult Details(int id)
 {
     Project project = new mongo().FindOne<Project>(p => p.Id == id);
     return View(project);
 }
 public ActionResult DeleteConfirmed(int id)
 {
     Project project = new mongo().FindOne<Project>(p => p.Id == id);
     new mongo().Delete<Project>(new { Id = project.Id });
     return RedirectToAction("Index");
 }
 //
 // GET: /Work/
 public ActionResult Index(int? id)
 {
     var projects = new mongo().GetCollection<Project>();
     return View(projects);
 }
Example #11
0
        public ActionResult Admin()
        {
            var models = new mongo().GetCollection <Rsvp>().Where(i => i.HasResponded).OrderByDescending(i => i.RespondedOn.GetValueOrDefault());

            return(View("Admin", models));
        }
Example #12
0
        //
        // GET: /Projects/Delete/5

        public ActionResult Delete(int id)
        {
            Project project = new mongo().FindOne <Project>(p => p.Id == id);

            return(View(project));
        }
Example #13
0
        //
        // GET: /Projects/Details/5

        public ViewResult Details(int id)
        {
            Project project = new mongo().FindOne <Project>(p => p.Id == id);

            return(View(project));
        }
        //
        // GET: /Work/

        public ActionResult Index(int?id)
        {
            var projects = new mongo().GetCollection <Project>();

            return(View(projects));
        }
        public ActionResult List()
        {
            var rsvp = new mongo().GetCollection<Rsvp>().OrderByDescending(i => i.RespondedOn);
            var vm = rsvp.Select(i => new RsvpViewModel(i));

            return View("List", vm);
        }
 public ActionResult Admin()
 {
     var models = new mongo().GetCollection<Rsvp>().Where(i => i.HasResponded).OrderByDescending(i => i.RespondedOn.GetValueOrDefault());
     return View("Admin", models);
 }
Example #17
0
        public ActionResult NoResponse()
        {
            var models = new mongo().GetCollection <Rsvp>().Where(i => !i.HasResponded).OrderBy(i => i.Primary.Name);

            return(View("NoResponse", models));
        }
 public ActionResult Update(int? id)
 {
     var model = new mongo().FindOne<Rsvp>(i => i.Id == id);
     var vm = new RsvpViewModel(model);
     return (vm != null) ? View("Index", vm) : View("Index");
 }
        public JsonResult Search(string term)
        {
            if (!String.IsNullOrEmpty(term))
            {
                var terms = term.Split(new char[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries);
                var collection = new mongo().GetCollection<Rsvp>();
                var matches = collection.Where(col => col.SearchTerms.Intersect(terms, new TermComparer()).Count() > 0);

                return Json(matches.Select(i => new RsvpJsonModel(i)), JsonRequestBehavior.AllowGet);
            }
            return Json(new { }, JsonRequestBehavior.AllowGet);
        }
 public ActionResult NoResponse()
 {
     var models = new mongo().GetCollection<Rsvp>().Where(i => !i.HasResponded).OrderBy(i => i.Primary.Name);
     return View("NoResponse", models);
 }
        public ActionResult Project(int id)
        {
            var project = new mongo().FindOne <Project>(p => p.Id == id);

            return(View(project));
        }
 //
 // GET: /Projects/Edit/5
 public ActionResult Edit(int id)
 {
     Project project = new mongo().FindOne<Project>(p => p.Id == id);
     return View(project);
 }
 //
 // GET: /Projects/
 public ViewResult Index()
 {
     var projects = new mongo().GetCollection<Project>();
     return View(projects);
 }
Example #24
0
        //
        // GET: /Projects/

        public ViewResult Index()
        {
            var projects = new mongo().GetCollection <Project>();

            return(View(projects));
        }