Example #1
0
        public bool Contactus(ContactUsModel _ContactUsModel)
        {
            _ContactUsModel.AppointmentDate = Convert.ToDateTime(_ContactUsModel.AppointmentDate);
            var userid  = User.Identity.GetUserId();
            var message = new InboxModel()
            {
                IsActive          = true,
                IsArchive         = false,
                IsProviderArchive = false,
                IsRead            = false,
                IsStarred         = false,
                MessageBody       = _ContactUsModel.CustomeMessageBody,
                RecipientId       = _ContactUsModel.ProviderUserId,
                SenderId          = userid,
                SentDate          = DateTime.Now,
                Subject           = "Consumer wants your Services",
            };

            if (_ContactUsModel.IsCall == true)
            {
                message.MessageBody = " Please call me with more information <br/>" + message.MessageBody;
            }
            var ContactUsid = _ContactUsModel.addContactUsForm(_ContactUsModel);

            message.ContactUsId = ContactUsid;
            new InboxModel().SaveCustomeMessage(message);
            if (_ContactUsModel.AppointmentSchedule == true)
            {
                var ProviderEmail = new ProviderListingModel().GetListingByListingId(_ContactUsModel.ProviderListingId).PrimaryEmail;
                SerdEmail(ProviderEmail, _ContactUsModel);
                //create appointment
                var model = new AppointmentModel();
                model.BestTime    = _ContactUsModel.AppointmentTime;
                model.ConsumerId  = userid;
                model.CreatedBy   = userid;
                model.CreatedDate = DateTime.Now;
                model.ProviderId  = _ContactUsModel.ProviderUserId;
                model.ServiceDate = _ContactUsModel.AppointmentDate;
                model.ContactUsId = ContactUsid;
                model.SubmitAppointment(model, "Consumer");
            }

            return(true);
        }