Example #1
0
        public JsonResult GetformMail(int id)
        {
            //lay nhan vien da duyet theo idNhanvien
            var nv = _duyetNhanVienRepository.GetnhanviendaduyetbyId(id);

            //lay mau mail co trong bang Mailtonhanviens. neu khong co thi lay noi dung mail mac dinh trong bang
            //noidungmail

            var mailcontent = _mailRepository.GetnoidungmailbyID(id, nv.VitriId);

            if (mailcontent.Id == 1)
            {
                return(new JsonResult(
                           new
                {
                    type = "custom",
                    tieude = mailcontent.Tieude,
                    noidung = mailcontent.Noidung,
                    thoigian = ""
                }
                           ));
            }

            return(new JsonResult(
                       new
            {
                type = "default",
                tieude = mailcontent.Tieude,
                noidung = "Xin chao " + nv.Ten + ", " + mailcontent.Noidung + "",
                thoigian = "" + nv.ThoigianPV + ""
            }
                       ));;
        }