public ActionResult PostSendMsgPateint(InboxModel inboxModel)
        {
            CommonData model = new CommonData();

            if (!ModelState.IsValid)
            {
                inboxModel.doclst2 = model.DoctorApp();
                return(View("SendMsgPateint", model));
            }
            int         memid       = Convert.ToInt32(Session["MemberId"]);
            MemberModel memberModel = new MemberModel();

            inboxModel.doclst2 = model.DoctorApp();
            using (ProjectEntities1 db = new ProjectEntities1())
            {
                var getdata = db.Doctors.FirstOrDefault(a => a.DoctorId == inboxModel.DoctorId);
                int mem     = getdata.MemberId;

                var    getdata2 = db.MemberLogins.FirstOrDefault(a => a.MemberId == mem);
                string ToEmail  = getdata2.EmailId;

                /*var getdata3 = db.Patients.FirstOrDefault(a => a.MemberId == memid);
                 * int mem2 = getdata3.MemberId;*/
                var getdata4 = db.MemberLogins.FirstOrDefault(a => a.MemberId == memid);
                inboxModel.MessageDate = DateTime.Now;
                inboxModel.FromEmailId = getdata4.EmailId;
                int    replyid = 0;
                string isRead  = "false";
                db.InsertMessagePat(inboxModel.FromEmailId, ToEmail, inboxModel.Subject, inboxModel.MessageDetail,
                                    inboxModel.MessageDate, replyid, isRead);
            }
            ViewBag.message = "Message Sent !";
            return(View("SendMsgPateint", inboxModel));
        }
Beispiel #2
0
        public ActionResult PostViewMessageDoc(InboxModel model)
        {
            using (ProjectEntities1 im = new ProjectEntities1())
            {
                int    memid     = Convert.ToInt32(Session["MemberId"]);
                var    gdata     = im.MemberLogins.FirstOrDefault(a => a.MemberId == memid);
                string FromEmail = gdata.EmailId;
                var    gdata2    = im.Inboxes.FirstOrDefault(a => a.MessageId == model.MessageId);

                string ToEmail = gdata2.FromEmailId;
                string IsRead  = "True";
                im.UpdateIsRead(gdata2.MessageId, IsRead);
                im.InsertMessagePat(FromEmail, ToEmail, model.Subject, model.MessageDetail, DateTime.Now, model.MessageId, IsRead);

                return(Json("Inserted"));
            }
        }