Exemple #1
0
        public ActionResult ContactInfo()
        {
            if (!CurrentUser.IsAuthenticated)
            {
                return(RedirectToAction("Login"));
            }
            var contactRegards = LookupService.ContactRegards().List.ToList();

            contactRegards.Insert(0, new KeyValuePair <long, string>(0, "What is this in regard to?"));
            ViewBag.ContactRegards = contactRegards;
            var view = new ContactInfoView
            {
                Email     = CurrentUser.Name,
                FirstName = CurrentUser.Data["FirstName"].ToString(),
                LastName  = CurrentUser.Data["LastName"].ToString()
            };

            return(View(view));
        }
Exemple #2
0
        public ActionResult ContactInfo(ContactInfoView request)
        {
            if (!CurrentUser.IsAuthenticated)
            {
                return(RedirectToAction("Login"));
            }
            request.ContactRegard =
                new KeyValuePair <long, string>(Convert.ToInt64(Request["ContactRegard.Key"]), "");

            /*
             * var school = CurrentUser.Schools()
             *      .FirstOrDefault(d => d.Value == CurrentUser.CurrentSchoolId().ToString(CultureInfo.InvariantCulture));
             *
             * request.School =  new KeyValuePair<long, string>(CurrentUser.CurrentSchoolId(), school != null ? school.Text : "");
             */

            request.School    = new KeyValuePair <long, string>(CurrentUser.CurrentSchoolId(), CurrentUser.Data["SchoolName"].ToString());
            request.UserId    = Convert.ToInt32(CurrentUser.Data["UserId"]);
            request.Email     = CurrentUser.Name;
            request.FirstName = CurrentUser.Data["FirstName"].ToString();
            request.LastName  = CurrentUser.Data["LastName"].ToString();
            var response = SchoolService.CreateContactInfo(new CreateContactInfoRequest {
                ContactInfo = request
            });

            if (response.Result == Result.Success)
            {
                InfoMessage = "Message sent!";
                return(RedirectToAction("ContactInfo"));
            }
            var contactRegards = LookupService.ContactRegards().List.ToList();

            contactRegards.Insert(0, new KeyValuePair <long, string>(0, "Select Regards To"));
            ViewBag.ContactRegards = contactRegards;
            ErrorMessage           = response.Message;
            return(View(request));
        }