Esempio n. 1
0
        public Status<bool> RequestApplication(EmailRequestApplicationModel model)
        {
            //create message
            var message = new MailMessage { Subject = model.LandlordEmail };
            message.To.Add(model.LeadEmail);

            //create model for it
            ViewData = new System.Web.Mvc.ViewDataDictionary(model);

            //render it
            PopulateBody(message, viewName: "RequestApplication");

            //send it
            return this.SendMessage(message);
        }
Esempio n. 2
0
        public Status <bool> RequestApplication(EmailRequestApplicationModel model)
        {
            //create message
            var message = new MailMessage {
                Subject = model.LandlordEmail
            };

            message.To.Add(model.LeadEmail);

            //create model for it
            ViewData = new System.Web.Mvc.ViewDataDictionary(model);

            //render it
            PopulateBody(message, viewName: "RequestApplication");

            //send it
            return(this.SendMessage(message));
        }
Esempio n. 3
0
        public Status<UserInterest> SendUserResponse(string username, int userInterestId, string response)
        {
            if (string.IsNullOrWhiteSpace(username))
                return Status.ValidationError<UserInterest>(null, "username", "The username is required");

            if (string.IsNullOrWhiteSpace(response))
                return Status.ValidationError<UserInterest>(null, "response", "Response is required");

            using (RentlerContext context = new RentlerContext())
            {
                try
                {
                    var lead = (from i in context.UserInterests
                                where i.Building.User.Username == username && i.UserInterestId == userInterestId
                                select i).SingleOrDefault();

                    if (lead == null)
                        return Status.NotFound<UserInterest>();

                    lead.ResponseMessage = response;
                    context.SaveChanges();

                    EmailRequestApplicationModel model = new EmailRequestApplicationModel(lead);
                    this.mailer.RequestApplication(model);

                    return Status.OK(lead);
                }
                catch (Exception ex)
                {
                    // log exception
                    return Status.Error<UserInterest>("System was unable to get lead", null);
                }
            }
        }