Beispiel #1
0
        public Noidungmail GetnoidungmailbyID(int Idnhanvien, int vitriid)
        {
            var mailtonhanvien = base._context.Mailtonhanviens.Where(x => x.NhanvienId == Idnhanvien).FirstOrDefault();
            var nhanvien       = base._context.Nhanviens.Find(Idnhanvien);

            if (mailtonhanvien == null)
            {
                var noidungmail = new Noidungmail();
                if (vitriid == 4)
                {
                    noidungmail = base._context.Noidungmails.Where(x => x.Loaimail == EMailType.MaiTTS).FirstOrDefault();
                }
                else if (vitriid == 5)
                {
                    noidungmail = base._context.Noidungmails.Where(x => x.Loaimail == EMailType.MailFresher).FirstOrDefault();
                }
                else if (vitriid == 6)
                {
                    noidungmail = base._context.Noidungmails.Where(x => x.Loaimail == EMailType.MailDev).FirstOrDefault();
                }
                return(noidungmail);
            }
            return(new Noidungmail
            {
                Id = 1,
                Noidung = mailtonhanvien.Noidung,
                Tieude = mailtonhanvien.Tieude
            });
        }
Beispiel #2
0
        public JsonResult UpdateMailContent([FromBody] Noidungmail model)
        {
            var result = _mailRepository.Update(model);

            if (result)
            {
                return(new JsonResult(new { mes = "thanh cong" }));
            }
            return(new JsonResult(new { mes = "that bai" }));
        }
Beispiel #3
0
        public bool Update(Noidungmail model)
        {
            var mail = _context.Noidungmails.Where(x => x.Id == model.Id).FirstOrDefault();

            if (mail != null)
            {
                mail.Tieude  = model.Tieude;
                mail.Noidung = model.Noidung;

                _context.SaveChanges();
                return(true);
            }
            return(false);
        }
Beispiel #4
0
 public bool Create(Noidungmail mail)
 {
     throw new NotImplementedException();
 }