Beispiel #1
0
        public static internalDTO.Description MapFromExternal(externalDTO.Description description)
        {
            var res = description == null ? null : new internalDTO.Description()
            {
                Id = description.Id,
                DescriptionValue = description.DescriptionValue
            };

            return(res);
        }
Beispiel #2
0
        public async Task <IActionResult> PutDescription(int id, v1_0_DTO.Description description)
        {
            if (id != description.Id)
            {
                return(BadRequest());
            }

            _bll.Descriptions.Update(v1_0_Mapper.DescriptionMapper.MapFromExternal(description));
            await _bll.SaveChangesAsync();

            return(NoContent());
        }
Beispiel #3
0
        public async Task <ActionResult <v1_0_DTO.Description> > PostDescription(v1_0_DTO.Description description)
        {
            description = v1_0_Mapper.DescriptionMapper.MapFromBLL(
                await _bll.Descriptions.AddAsync(v1_0_Mapper.DescriptionMapper.MapFromExternal(description)));
            await _bll.SaveChangesAsync();

            description = v1_0_Mapper.DescriptionMapper.MapFromBLL(
                _bll.Descriptions.GetUpdatesAfterUOWSaveChanges(
                    v1_0_Mapper.DescriptionMapper.MapFromExternal(description)));

            return(CreatedAtAction("GetDescription", new { version = HttpContext.GetRequestedApiVersion().ToString(),
                                                           id = description.Id }, description));
        }