Example #1
0
 private void updateTable(IDataManager tableManager, Entry entry)
 {
     //If the database was not able to update the entity, attempt to add it instead
     if (!tryCommand(tableManager.UpdateEntity(entry)))
     {
         tryCommand(tableManager.AddEntity(entry));
     }
 }
        public async Task <IActionResult> PostStudent([FromBody] StudentDO studentDO)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                var result = await dataManager.AddEntity(dbContext, studentDO);

                return(Created("", studentDO));
            }
            catch (EntityNotFoundException ex)
            {
                return(NotFound(ex.Message));
            }
        }