public async Task <IActionResult> CreateAsync([FromBody] DependentDomainModel model)
        {
            if (model == null)
            {
                return(BadRequest("The model that is passed in is empty. Model object is required."));
            }

            DependentDomainModel inserted;

            try { inserted = await _domain.InsertAsync(model).ConfigureAwait(false); }
            catch (Exception ex) { return(BadRequest(ex.InnerException)); }

            return(CreatedAtRoute("GetDependent", new { id = inserted.DependentId }, inserted));
        }
Exemple #2
0
        public void InsertAsync_WithNullDependentParameter_ReturnArgumentNullException()
        {
            Func <Task> act = () => _domain.InsertAsync(null);

            act.Should().Throw <ArgumentNullException>();
        }