public async Task <IActionResult> Create([FromBody] RegisterView register) { try { var brand = EntityBuilder.Call <CarBrand>(register); await _save.Execute(brand); return(StatusCode(201)); } catch (RegisterExistException err) { return(StatusCode(401, new { Message = err.Message })); } }
public async Task SaveSucess() { var carBrand = new CarBrand() { Name = "test-save" }; Exception exception = null; try { await _service.Execute(carBrand); }catch (Exception e) { exception = e; } Assert.AreEqual(exception, null); }
public async Task <IActionResult> Create([FromBody] RegisterView register) { try { var brand = new CarBrand() { Name = register.Name }; await _save.Execute(brand); return(StatusCode(201)); } catch (RegisterExistException err) { return(StatusCode(401, new { Message = err.Message })); } }