Пример #1
0
        public async Task <ActionResult <CustomerDto> > Authenticate([FromBody] Authenticate authenticate)
        {
            _orm.OpenConn();
            var customerFromDB = await _orm.Authenticate(authenticate.Email, authenticate.Password);

            if (customerFromDB == null)
            {
                return(NotFound());
            }
            var customerDto = _mapper.Map <CustomerDto>(customerFromDB);
            await _orm.CloseConn();

            return(CreatedAtRoute("GetCustomersByID", new { id = customerDto.Id }, customerDto));
        }