예제 #1
0
        public void table_should_return_pk_reference_error(DataTablePayload db)
        {
            var response = callCreateTable(db);

            Assert.NotNull(response.Value);
            Assert.Equal("Primary key can not be reference attribute.", response.Value.message);
        }
예제 #2
0
        public void table_should_return_pk_not_found(DataTablePayload db)
        {
            var response = callCreateTable(db);

            Assert.NotNull(response.Value);
            Assert.Equal("Invalid number of primary key", response.Value.message);
        }
예제 #3
0
        public void table_should_return_quantity_error(DataTablePayload db)
        {
            var response = callCreateTable(db);

            Assert.NotNull(response.Value);
            Assert.Equal("Database must have at least 2 attributes.", response.Value.message);
        }
예제 #4
0
        public void table_should_return_db_not_found(DataTablePayload db)
        {
            var response = callCreateTable(db);

            Assert.NotNull(response.Value);
            Assert.Equal($"Database {db.databaseKey} not found.", response.Value.message);
        }
예제 #5
0
 public ActionResult <APIResponse <TableViewModel> > table(DataTablePayload payload)
 {
     return(base.BeginCommonHandler <TableViewModel>(response => {
         response.content = _mapper.Map <TableViewModel>(_databaseService.createTable(payload.databaseKey, payload.tableName
                                                                                      , _mapper.Map <List <TableAttribute> >(payload.attributes)));
     }));
 }
예제 #6
0
        public DataTablePayload <T> GetDataTablePayload <T>()
        {
            var payload = new DataTablePayload <T>();

            payload.Draw = HttpContext.Request.Form["draw"].FirstOrDefault();

            // Skip number of Rows count
            payload.Skip = Request.Form["start"].FirstOrDefault() != null?Convert.ToInt32(Request.Form["start"].FirstOrDefault()) : 0;

            // Paging Length 10,20
            payload.PageSize = Request.Form["length"].FirstOrDefault() != null?Convert.ToInt32(Request.Form["length"].FirstOrDefault()) : 0;

            // Sort Column Name
            payload.SortColumn = Request.Form["columns[" + Request.Form["order[0][column]"].FirstOrDefault() + "][name]"].FirstOrDefault();

            // Sort Column Direction (asc, desc)
            payload.SortColumnDirection = Request.Form["order[0][dir]"].FirstOrDefault();

            // Search Value from (Search box)
            payload.SearchValue = Request.Form["search[value]"].FirstOrDefault();

            return(payload);
        }
예제 #7
0
 private ActionResult <APIResponse <TableViewModel> > callCreateTable(DataTablePayload payload)
 {
     return(this._controller.table(payload));
 }