Exemplo n.º 1
0
        public static internalDTO.RouteOfAdministration MapFromExternal(externalDTO.RouteOfAdministration routeOfAdministration)
        {
            var res = routeOfAdministration == null ? null : new internalDTO.RouteOfAdministration()
            {
                Id = routeOfAdministration.Id,
                RouteOfAdministrationValue = routeOfAdministration.RouteOfAdministrationValue
            };

            return(res);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> PutRouteOfAdministration(int id, v1_0_DTO.RouteOfAdministration routeOfAdministration)
        {
            if (id != routeOfAdministration.Id)
            {
                return(BadRequest());
            }

            _bll.RouteOfAdministrations.Update(v1_0_Mapper.RouteOfAdministrationMapper.MapFromExternal(routeOfAdministration));
            await _bll.SaveChangesAsync();

            return(NoContent());
        }
Exemplo n.º 3
0
        public async Task <ActionResult <v1_0_DTO.RouteOfAdministration> > PostRouteOfAdministration(v1_0_DTO.RouteOfAdministration routeOfAdministration)
        {
            routeOfAdministration = v1_0_Mapper.RouteOfAdministrationMapper.MapFromBLL(
                await _bll.RouteOfAdministrations.AddAsync(v1_0_Mapper.RouteOfAdministrationMapper.MapFromExternal(routeOfAdministration)));
            await _bll.SaveChangesAsync();

            routeOfAdministration = v1_0_Mapper.RouteOfAdministrationMapper.MapFromBLL(
                _bll.RouteOfAdministrations.GetUpdatesAfterUOWSaveChanges(
                    v1_0_Mapper.RouteOfAdministrationMapper.MapFromExternal(routeOfAdministration)));

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