public IActionResult Create([FromBody] Config model) { if (!ModelState.IsValid) { return(BadRequest()); } _config.Create(model); return(Ok()); }
public FluentRecordBase AddConfig() { // // DEPENDENCIES _servC = ToServ <IConfigService>(); // // ARRANGE _config.updatedby = _user; _config.createdby = _user; // // ACT _servC.Create(_config, _user); return(this); }
public HttpResponseMessage Create(ConfigAddRequest model) { try { if (ModelState.IsValid) { int id = _configService.Create(model); ItemResponse <int> resp = new ItemResponse <int>(); resp.Item = id; return(Request.CreateResponse(HttpStatusCode.OK, resp)); } else { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex)); } }