Example #1
0
        public void Create(CreateLocationRequestDTO dto)
        {
            List <Country> countiesAuxiliares = AutoMapper.Mapper.Map <List <Country> >(dto.Countries);

            //actualizar ref

            foreach (Country c in countiesAuxiliares)
            {
                foreach (State s in c.States)
                {
                    foreach (City city in s.Cities)
                    {
                        city.State = s;
                    }

                    s.Country = c;
                }

                this.UnitOfWork.CountryRepository.Add(c);
            }

            this.UnitOfWork.SaveChanges();
        }
 public IHttpActionResult Create(CreateLocationRequestDTO dto)
 {
     //this layer must validate dto
     this.Servicio.Create(dto);
     return(Ok(dto));
 }