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