public async Task <IActionResult> Post([FromBody] Models.Saving saving)
        {
            if (saving == null)
            {
                //_logger.LogInformation($"User is empty when accessing to UserController/Post(UserDto saving).");
                return(BadRequest());
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var savingEntity = _mapper.Map <Entities.Saving>(saving);
            await _savingRepository.AddAsync(savingEntity);

            if (!await _savingRepository.SaveAsync())
            {
                // _logger.LogError($"Add User is not valid. Error in SaveAsync(). When accessing to UserController/Post");
                return(StatusCode(500, "A problem happend while handling your request."));
            }

            //TODO: Implement Realistic Implementation
            return(Created("", null));
        }
Пример #2
0
 public System.Threading.Tasks.Task <int> AddSavingAsync(Models.Saving saving, Models.Warehouse warehouse)
 {
     return(base.Channel.AddSavingAsync(saving, warehouse));
 }
Пример #3
0
 public int AddSaving(Models.Saving saving, Models.Warehouse warehouse)
 {
     return(base.Channel.AddSaving(saving, warehouse));
 }