Пример #1
0
        public ActionResult PostMessageToDoctor(InboxMessageModel model)
        {
            int mid = Convert.ToInt32(Session["MemberId"]);

            using (ProjectEntities db = new ProjectEntities())
            {
                var    getdata     = db.MemberLogins.FirstOrDefault(a => a.MemberId == mid);
                string Fromemailid = getdata.EmailId;
                int    docid       = Convert.ToInt32(model.ToEmailId);
                var    data        = (from d in db.Doctors join m in db.MemberLogins
                                      on d.MemberId equals m.MemberId
                                      where d.DoctorId == docid
                                      select new { m.EmailId }).FirstOrDefault();

                model.ToEmailId = data.EmailId;
                DateTime msgdate = DateTime.Now;
                int      rid     = 0;
                bool     isread  = false;

                if (model.ToEmailId != null)
                {
                    db.InsertMessage(Fromemailid, model.ToEmailId, model.Subject, model.MessageDetail, msgdate, rid, isread);
                    ViewBag.Message = "Message Sent To Doctor";
                }
                else
                {
                    ViewBag.Message = "Select Your Doctor";
                }
            }

            List <SelectListItem> lst = new List <SelectListItem>();     // populate ddlDoctor after submit

            using (ProjectEntities db = new ProjectEntities())
            {
                var getdata = db.Doctors.ToList();
                foreach (var item in getdata)
                {
                    lst.Add(new SelectListItem
                    {
                        Value = item.DoctorId.ToString(),
                        Text  = item.FirstName
                    });
                }
            }

            DoctorAppointmentModel model1 = new DoctorAppointmentModel();

            model1.lstDoctor = lst;
            return(View("DoctorAppointment", model1));
        }
Пример #2
0
        public ActionResult PostPatientReply(InboxMessageModel model)
        {
            bool isread = false;

            using (ProjectEntities db = new ProjectEntities())
            {
                if (model.MessageDetail != null)
                {
                    // Insert Reply
                    db.InsertMessage(model.ToEmailId, model.FromEmailId, model.Subject, model.MessageDetail,
                                     DateTime.Now, model.MessageId, isread);

                    // update IsRead
                    db.UpdateIsRead(model.MessageId, true);

                    return(Json("Reply Sent"));
                }
                else
                {
                    return(Json("Reply Message Body is Empty"));
                }
            }
        }