Пример #1
0
        public async Task <IActionResult> RegisterSite([FromQuery] ApplicationContext context, [FromBody] SiteRegistrationDto siteRegistration)
        {
            Site site = Mapper.Map <Site>(siteRegistration);

            site.SiteType = context;
            site.Devices  = Enumerable.Empty <Device>();
            if (site.Zones == null)
            {
                site.Zones = Enumerable.Empty <string>();
            }
            Site newSite = siteService.Create(site);

            return(Ok(Mapper.Map <SiteOverviewDto>(newSite)));
        }
Пример #2
0
        public void Create_ValidModel_ReturnId(int newId)
        {
            //arrange
            var newItem = new Site();

            //act
            var service  = new SiteService(_siteRepository.Object, _facilityRepository.Object, _logger.Object);
            var returnId = service.Create(newItem);

            //assert
            Assert.Equal(newId, returnId);
            Assert.NotEqual(0, newItem.Id);
            Assert.NotEqual(DateTime.MinValue, newItem.Created);
            Assert.True(_siteData.Count == 2);
        }
Пример #3
0
 public async Task <SiteEditModel> Create()
 {
     return(await _service.Create());
 }
Пример #4
0
        public async Task <IActionResult> CreateSite([FromBody] Site model)
        {
            var data = await _siteService.Create(model);

            return(Ok(data));
        }
 public SiteEditModel Create()
 {
     return(_service.Create());
 }
Пример #6
0
        public async Task <IHttpActionResult> Post(IEnumerable <SexSpiders> models)
        {
            await service.Create(models);

            return(Ok());
        }