Exemplo n.º 1
0
        public virtual async void TestDelete()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);
            var        client     = new ApiClient(testServer.CreateClient());

            client.SetBearerToken(JWTTestHelper.GenerateBearerToken());
            ApplicationDbContext context = testServer.Host.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext;

            ITableService service = testServer.Host.Services.GetService(typeof(ITableService)) as ITableService;
            var           model   = new ApiTableServerRequestModel();

            model.SetProperties("B");
            CreateResponse <ApiTableServerResponseModel> createdResponse = await service.Create(model);

            createdResponse.Success.Should().BeTrue();

            ActionResponse deleteResult = await client.TableDeleteAsync(2);

            deleteResult.Success.Should().BeTrue();
            ApiTableServerResponseModel verifyResponse = await service.Get(2);

            verifyResponse.Should().BeNull();
        }
Exemplo n.º 2
0
        public IUiBase Create()
        {
            var result = Create(service.Create());

            if (cache != null)
            {
                cache.Add(result);
            }
            return(result);
        }
Exemplo n.º 3
0
        public void Calc()
        {
            FCService.Init(db);
            var sel   = ed.Select("\nВыбор:");
            var areas = GetAreas(sel);

            // Группировка и суммирование
            CalcData(areas);
            // Таблица
            var table = tableService.Create();

            tableService.Insert(table, doc);
        }
Exemplo n.º 4
0
        public async Task <ActionResult <Table_TableDTO> > Create([FromBody] Table_TableDTO Table_TableDTO)
        {
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            Table Table = ConvertDTOToEntity(Table_TableDTO);

            Table = await TableService.Create(Table);

            Table_TableDTO = new Table_TableDTO(Table);
            if (Table.IsValidated)
            {
                return(Table_TableDTO);
            }
            else
            {
                return(BadRequest(Table_TableDTO));
            }
        }
 public IActionResult Create(T model)
 {
     tableService.Create(model);
     return(View("Index", tableService.GetPart()));
 }
Exemplo n.º 6
0
 public RedirectResult Add(TableDTO table)
 {
     _tableService.Create(table);
     return(Redirect("/Table/GetAll"));
 }