Esempio n. 1
0
        public async Task <ActionResult> GetUserByPhoneNumber([FromQuery] string phoneNumber)
        {
            Response.Headers.Add("Access-Control-Allow-Origin", "*");
            if (phoneNumber == null)
            {
                return(BadRequest(new ArgumentNullException(nameof(phoneNumber))));
            }
            var user = await _repository.GetUserByProp(u => u.PhoneNumber == phoneNumber);

            if (user == null)
            {
                return(NotFound());
            }
            var membership = await _repository.GetMembershipByUserId(user.Id);

            return(Ok(new
            {
                user = _mapper.Map <UserReadDto>(user),
                isMember = membership != null
            }));
        }