Ejemplo n.º 1
0
        public static DoResult ChangeStatus(GiaSinhVienEntities db, long id, UserStatus newStatus)
        {
            return(DAOCore.Do(c =>
            {
                var it = db.UserInfoes.Single(x => x.Id == id);

                it.Status = newStatus;
                db.SaveChanges();
            }));
        }
Ejemplo n.º 2
0
        public static DoResult <UserInfo> Update(GiaSinhVienEntities db, UserInfo data)
        {
            return(DAOCore.Do <UserInfo>(c =>
            {
                var it = db.UserInfoes.Single(x => x.Id == data.Id);
                it.UserName = data.UserName;
                it.Phone = data.Phone;
                it.Address = data.Address;
                it.AvatarPhoto = data.AvatarPhoto;
                it.Email = data.Email;
                it.GroupId = data.GroupId;

                db.SaveChanges();

                return it;
            }));
        }
Ejemplo n.º 3
0
        public static DoResult <UserInfo> Insert(GiaSinhVienEntities db, UserInfo data)
        {
            return(DAOCore.Do <UserInfo>(c =>
            {
                var it = new UserInfo();
                it.Passwork = data.Passwork;
                it.UserName = data.UserName;
                it.Phone = data.Phone;
                it.Address = data.Address;
                it.AvatarPhoto = data.AvatarPhoto;
                it.Email = data.Email;
                it.GroupId = data.GroupId;
                it.CreateDate = DateTime.Now;
                it.Status = UserStatus.Active;

                db.UserInfoes.Add(it);
                db.SaveChanges();

                return it;
            }));
        }