Example #1
0
        public string Sua(NguoiDungBDO entityBDO)
        {
            NGUOI_DUNG entity = db.NGUOI_DUNG.Where(x => x.ID == entityBDO.ID).SingleOrDefault();
            var        kq     = "";

            if (entity != null)
            {
                try
                {
                    kq = KiemTraTrung(entityBDO.Ten, entityBDO.ID);
                    if (kq != "")
                    {
                        return(kq);
                    }

                    ChuyenBDOThanhDAO(entityBDO, entity);
                    db.Entry(entity).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                    kq = string.Format("Lưu mục tin {0} thành công", entity.ID);//trả về số Id
                }
                catch
                {
                    kq = string.Format("Sửa mục tin {0} không thành công!", entity.ID);
                }
            }
            else
            {
                return(kq = string.Format("Mục tin {0} không tồn tại!", entity.ID));
            }
            return(kq);
        }
Example #2
0
 private void ChuyenBDOThanhDAO(NguoiDungBDO entityBDO, NGUOI_DUNG entityDAO)
 {
     entityDAO.ID  = entityBDO.ID;
     entityDAO.ten = entityBDO.Ten;
     entityDAO.cho_hang_khach_hang = entityBDO.ChoHangKhachHang;
     entityDAO.form_co_the_mo      = entityBDO.FormCoTheMo;
     entityDAO.hieu_luc            = entityBDO.HieuLuc;
 }