Exemple #1
0
        public bool RemoveUser(int idUser)
        {
            tbl_1_User instance = Db.tbl_1_Users.Where(p => p.IDUser == idUser).FirstOrDefault();

            if (instance != null)
            {
                Db.tbl_1_Users.DeleteOnSubmit(instance);
                Db.tbl_1_Users.Context.SubmitChanges();
                return(true);
            }

            return(false);
        }
Exemple #2
0
        public bool UpdateUser(tbl_1_User instance)
        {
            tbl_1_User cache = Db.tbl_1_Users.Where(p => p.IDUser == instance.IDUser).FirstOrDefault();

            if (cache != null)
            {
                cache.Birthdate  = instance.Birthdate;
                cache.AvatarPath = instance.AvatarPath;
                cache.Email      = instance.Email;
                Db.tbl_1_Users.Context.SubmitChanges();
                return(true);
            }
            return(false);
        }
Exemple #3
0
        public bool CreateUser(tbl_1_User instance)
        {
            if (instance.IDUser == 0)
            {
                instance.AddedDate = DateTime.Now;
                ///TODO Refctor this code!!!!!!!!
                #region hardcode CityId, PrivilegeId, OrganizationId.
                instance.CityId         = 1;
                instance.PrivilegeId    = 1;
                instance.OrganizationId = 1;
                #endregion
                instance.ActivatedLink = tbl_1_User.GetActivateUrl();
                Db.tbl_1_Users.InsertOnSubmit(instance);
                Db.tbl_1_Users.Context.SubmitChanges();
                return(true);
            }

            return(false);
        }