Exemplo n.º 1
0
        public IActionResult Add(SaveEnvironmentRequestDTO environmentDTO)
        {
            DB.Models.Environment environment = _mapper.Map <DB.Models.Environment>(environmentDTO);

            var res = _service.Add(environment);

            if (res.IsSuccess)
            {
                return(Ok(res.IsSuccess));
            }
            else
            {
                return(BadRequest(res.Errors));
            }
        }
Exemplo n.º 2
0
        public IActionResult Post([FromBody] EnvironmentViewModel environmentViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var environment = _service.Add(environmentViewModel);

            if (environment is null)
            {
                return(NoContent());
            }

            return(CreatedAtAction(nameof(Get), new { environment.Id }, environment));
        }
        public void Add(EnvironmentViewModel environmentVM)
        {
            var environment = Mapper.Map <SystemEnvironment>(environmentVM);

            _environmentService.Add(environment);
        }