예제 #1
0
        public virtual HttpResponseMessage GetEntity(int id)
        {
            var entity = _service.GetByID(id).Data;

            if (entity == null)
            {
                throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));
            }

            return(Request.CreateResponse(HttpStatusCode.OK, _mapper.GetDTOForEntity <TEntity, TEntityDTO>(entity)));
        }
예제 #2
0
        public void DTOMapperEntityToDTOTest()
        {
            Location location = new Location()
            {
                Name       = "asdf",
                Address    = "zxvc",
                LocationID = 1
            };

            var dto = mapper.GetDTOForEntity <Location, LocationDTO>(location);

            AssertLocationDTO(location, dto);
        }