Exemple #1
0
        public async Task <ActionResult> PostAsync([FromBody] CreateDroid createDroid)
        {
            try
            {
                var droid = await _droidHandler.HandleAsync(createDroid);

                return(CreatedAtAction(
                           nameof(GetAsync),
                           new { serialNumber = (Guid)droid.SerialNumber },
                           droid.ToViewModel()));
            }
            catch (BusinessException ex) { return(ex.GetStatusCode()); }
        }