Esempio n. 1
0
        public string DeleteUser(string DeleteID)
        {
            string Str = "刪除失敗";

            try {
                MXIC_UserManagement User = _db.MXIC_UserManagements.Where(x => x.DeleteID.ToString() == DeleteID).FirstOrDefault();

                //User.UserDisable = false;
                _db.MXIC_UserManagements.Remove(User);
                _db.SaveChanges();
                Str = "刪除成功";
            }catch (Exception e)
            {
                Str = e.ToString();
            }
            return(Str);
        }
Esempio n. 2
0
        public string AddUser(string DepNo, string DepName, string UserID, string UserName, string Admin, string PassWord)
        {
            string Str = "新增成功";

            var AddUser = new MXIC_UserManagement()
            {
                UserListID  = Guid.NewGuid(),
                DepNo       = DepNo,
                DepName     = DepName,
                UserID      = UserID,
                UserName    = UserName,
                Admin       = Admin,
                PassWord    = PassWord,
                UserDisable = true,
                EditID      = Guid.NewGuid(),
                DeleteID    = Guid.NewGuid()
            };

            _db.MXIC_UserManagements.Add(AddUser);

            _db.SaveChanges();

            return(Str);
        }