Beispiel #1
0
        public async Task Should_Record_Basic_Wage_Data()
        {
            var basicWage = new BasicWage {
                Id = 1, Value = 2000
            };
            var result = await _basicWageService.RecordBasicWageDataAsync(basicWage);

            Assert.IsTrue(result.Success);
            Assert.AreEqual(basicWage.Value, result.BasicWage.Value);
        }
Beispiel #2
0
        public async Task <IActionResult> RecordBasicWageDataAsync([FromBody] BasicWageResource basicWageResource)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var basicWageData = _mapper.Map <BasicWageResource, BasicWage>(basicWageResource);

            var response = await _basicWageService.RecordBasicWageDataAsync(basicWageData);

            if (!response.Success)
            {
                return(BadRequest(response.Message));
            }

            var resource = _mapper.Map <BasicWage, BasicWageResource>(response.BasicWage);

            return(Ok(resource));
        }