public ViewResult CreateNote(Note note, Location location, HttpPostedFileBase upload)
        {
            if (upload != null)
            {
                var file = new File
                {
                    FileName = upload.FileName,
                    ContentType = upload.ContentType
                };

                using (var reader = new System.IO.BinaryReader(upload.InputStream))
                {
                    file.Content = reader.ReadBytes(upload.ContentLength);
                }

                note.File = file;
            }

            note.UserId = this.User.Identity.GetUserId();
            note.CreationDate = DateTime.Now;
            note.CreationLocation = LocationUtil.ParseLocation(location);

            this.noteService.CreateNote(note);

            return this.View("FinishNoteCreation", note);
        }
        public ActionResult AvailablePolls(Location location)
        {
            var user = new User { Id = this.User.Identity.GetUserId() };

            var availablePools = this.pollService.GetAvailablePollsForAnswer(location, user);

            return this.View(availablePools);
        }
        public RedirectToRouteResult CreatePoll(QuestionType questionType, Poll poll, Location location)
        {
            poll.Questions = new List<Question>();
            poll.CreationLocation = LocationUtil.ParseLocation(location);

            this.Session[PollKey] = poll;

            return this.GoToCreateQuestion(questionType);
        }
 public static DbGeography ParseLocation(Location location)
 {
     return DbGeography.PointFromText(string.Format("POINT({0} {1})", location.Longitude, location.Latitude), 4326);
 }
        public ViewResult AvailableNotes(Location location)
        {
            var notes = this.noteService.GetAvailableNotes(location);

            return this.View(notes);
        }