Example #1
0
        public async Task <IActionResult> Add([FromBody] AppointmentRequestDto requestDto)
        {
            m_Logger.Information($"{nameof(Add)} Invoked");
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            try
            {
                var  request = m_Mapper.Map <AppointmentDto>(requestDto);
                bool result  = await m_AppointmentManager.AddAppointmentAsync(request).ConfigureAwait(false);

                if (result)
                {
                    return(Ok(result));
                }
            }
            catch (Exception ex)
            {
                m_Logger.Error(ex, "Error caught in the controller class.");
            }
            return(BadRequest(HttpStatusCode.BadRequest));
        }