コード例 #1
0
        public async Task <IActionResult> PutUserMaster(long id, UserMaster userMaster)
        {
            if (id != userMaster.UserId)
            {
                return(BadRequest());
            }

            _context.Entry(userMaster).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!UserMasterExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #2
0
        public async Task <ServiceResponse <int> > Register(UserMaster userMaster, string password)
        {
            ServiceResponse <int> response = new ServiceResponse <int>();

            //if (await UserExists(userMaster.EmailId, (long)userMaster.MobileNo))
            if (await EmailIdExists(userMaster.EmailId))
            {
                response.Success = false;
                response.Message = "User Already Exists";
                return(response);
            }
            CreatePasswordHash(password, out byte[] passwordSalt, out byte[] passwordHash);
            userMaster.PasswordHash = passwordHash;
            userMaster.PasswordSalt = passwordSalt;
            userMaster.UserTypeId   = 3828;
            userMaster.PlanId       = 6545;
            userMaster.Status       = true;
            await _context.UserMaster.AddAsync(userMaster);

            await _context.SaveChangesAsync();

            response.Data = (int)userMaster.UserId;
            return(response);
        }
コード例 #3
0
        public async Task <ServiceResponse <int> > Register_UserInfo(UserInfo uinfo)
        {
            ServiceResponse <int> response = new ServiceResponse <int>();

            try
            {
                await _context.UserInfo.AddAsync(uinfo);

                await _context.SaveChangesAsync();

                response.ResponseCode = 200;
                response.Message      = "User Information Added Successfully";
                response.Success      = true;
            }
            catch (Exception ex)
            {
                response.ResponseCode = 301;
                response.Message      = ex.Message;
                response.Success      = false;
            }
            return(response);
        }