Exemplo n.º 1
0
        private AddedColumn MapToEntity(AddedColumnCreateModel model)
        {
            AddedColumn entity = new AddedColumn();

            entity.ID         = (int)_sequence.GetNextSequenceValue(typeof(AddedColumn).Name);
            entity.ColumnName = model.ColumnName;
            entity.ColumnType = model.ColumnType;
            entity.EntityName = model.EntityName;
            return(entity);
        }
Exemplo n.º 2
0
        public async Task <ResultModel <AddedColumnModel> > Create(AddedColumnCreateModel model)
        {
            try
            {
                AddedColumn entity = MapToEntity(model);
                entity = await _addedColumn.Add(entity);

                await _addedColumn.Commit();

                AddedColumnModel returnModel = MapToModel(entity);
                return(ResultModel <AddedColumnModel> .GetSuccessResult(returnModel));
            }
            catch (Exception e)
            {
                await _addedColumn.Abort();

                ResultErrorModel error = new ResultErrorModel(e);
                return(ResultModel <AddedColumnModel> .GetExceptionResult(error));
            }
        }
Exemplo n.º 3
0
 public async Task <IActionResult> Post([FromBody] AddedColumnCreateModel model)
 {
     return(await GetResult(await _addedColumn.Create(model)));
 }