コード例 #1
0
        public Status <bool> SendApplication(EmailSendApplicationModel model)
        {
            //create message
            var message = new MailMessage {
                Subject = "Application Submitted"
            };

            message.To.Add(model.LandlordEmail);

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

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

            //send it
            return(this.SendMessage(message));
        }
コード例 #2
0
        public Status<bool> SendApplication(EmailSendApplicationModel model)
        {
            //create message
            var message = new MailMessage { Subject = "Application Submitted" };
            message.To.Add(model.LandlordEmail);

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

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

            //send it
            return this.SendMessage(message);
        }
コード例 #3
0
 public Status<bool> SendApplication(EmailSendApplicationModel model)
 {
     return SendMail(model, "account/sendapplication");
 }
コード例 #4
0
        public Status<UserInterest> SendApplication(string username, int userInterestId, UserApplication application)
        {
            if (string.IsNullOrWhiteSpace(username))
                return Status.ValidationError<UserInterest>(null, "username", "The username is required");

            // validate UserApplication
            var appStatusValid = Status.Validatate<UserApplication>(application);

            if (appStatusValid.StatusCode != 200)
                return Status.ValidationError<UserInterest>(null, "application", "The application is not valid");

            // update user application
            var appStatusSave = SaveApplicationForUser(username, application);

            if (appStatusSave.StatusCode != 200)
                return Status.Error<UserInterest>("System was unable to update application", null);

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

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

                    // update lead - ApplicationSubmitted = true
                    lead.ApplicationSubmitted = true;

                    context.SaveChanges();

                    EmailSendApplicationModel model = new EmailSendApplicationModel(lead);
                    mailer.SendApplication(model);

                    return Status.OK(lead);
                }
                catch (Exception ex)
                {
                    // log exception
                    return Status.Error<UserInterest>("System was unable to get lead", null);
                }
            }
        }
コード例 #5
0
 public Status <bool> SendApplication(EmailSendApplicationModel model)
 {
     return(SendMail(model, "account/sendapplication"));
 }