Пример #1
0
        public bool Register(RegisterRowData data)
        {
            bool result = false;

            try
            {
                var record = dbcontext.S_USER.FirstOrDefault(x => x.EMAIL == data.Email || x.PHONE == data.Phone);
                if (record == null)
                {
                    record           = new S_USER();
                    record.USER_ID   = commonModel.GetAutoId("USER_ID", "S_USER");
                    record.FULL_NAME = data.Fullname;
                    record.EMAIL     = data.Email;
                    record.PASSWORD  = commomFunction.MD5Hash(data.Password);
                    record.PHONE     = data.Phone;
                    record.ADDRESS   = data.Address;
                    record.PACKED_ID = ConstantClass.PACKED_DEFAULT;
                    record.USER_TYPE = data.Usertype;
                    dbcontext.S_USER.Add(record);
                    dbcontext.SaveChanges();
                    result = true;
                }
            }
            catch (Exception ex)
            {
                logger.Error("Register - " + ex);
                result = false;
            }
            return(result);
        }