Esempio n. 1
0
 public IActionResult Create([FromBody] Config model)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest());
     }
     _config.Create(model);
     return(Ok());
 }
Esempio n. 2
0
        public FluentRecordBase AddConfig()
        {
            //
            // DEPENDENCIES
            _servC = ToServ <IConfigService>();

            //
            // ARRANGE
            _config.updatedby = _user;
            _config.createdby = _user;
            //
            // ACT
            _servC.Create(_config, _user);
            return(this);
        }
Esempio n. 3
0
 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));
     }
 }