Пример #1
0
        public IActionResult Post(AppointmentPostBM inputs)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            else
            {
                AppointmentLogic aptLogic = new AppointmentLogic(_unitOfWork);

                Appointment apt;
                inputs.ConvertTo(out apt);

                try
                {
                    Appointment result = aptLogic.Create(apt);

                    if (result != null)
                    {
                        return(new JsonResult(result));
                    }
                    else
                    {
                        return(NotFound());
                    }
                }
                catch (Exception ex)
                {
                    return(BadRequest(ex));
                }
            }
        }