public async Task <IActionResult> Post([FromBody] SetupDTO setupDto)
        {
            var setup = _mapper.Map <Setup>(setupDto);
            await _setupServices.Add(setup);

            setupDto = _mapper.Map <SetupDTO>(setup);

            var response = new GenericResponse <SetupDTO>(setupDto);

            return(Ok(response));
        }
Esempio n. 2
0
 public List<TimeFrame> UpdatedRun(SetupDTO setupDTO)
 {
     _simulationService.Init(setupDTO.TimeFrame, new InitialConditionsDTO
     {
         AngleBelowHorizontal = setupDTO.AngleBelowHorizontal,
         AngleOfAttack = setupDTO.AngleOfAttack,
         Height = setupDTO.Height,
         Mass = setupDTO.Mass,
         Radius = setupDTO.Radius,
         Velocity = setupDTO.Velocity
     }, setupDTO.VehicleType);
     var output = _simulationService.UpdatedRun(setupDTO.Time);
     return output;
 }
        public async Task <IActionResult> Put(int id, SetupDTO setupDto)
        {
            try
            {
                var setup = _mapper.Map <Setup>(setupDto);
                setup.Setup_Id = id;

                await _setupServices.Update(setup);

                var response = new GenericResponse <bool>(true);
                return(Ok(response));
            }
            catch (Exception ex)
            {
                throw new BusinessException(MessageCodes.PROPERTY_NO_VALID, GetErrorDescription(MessageCodes.PROPERTY_NO_VALID), ex.Message);
            }
        }