示例#1
0
        public IActionResult Post(PatientPostBM inputs)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            else
            {
                PatientLogic aptLogic = new PatientLogic(_unitOfWork);

                Patient pat;
                inputs.ConvertTo(out pat);

                try
                {
                    Patient result = aptLogic.Create(pat);

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