Beispiel #1
0
        public void AddCity(AddCityDto dto, string currentUserId)
        {
            UserManager.IsUserInAdministrationRole(currentUserId);
            var repository = UnitOfWork.Repository <ICityRepository>();
            var city       = repository.GetAll(true).SingleOrDefault(c => !c.IsDeleted && c.Name == dto.Name);

            if (city != null)
            {
                throw new BusinessFaultException(BusinessLogicExceptionResources.CityAlreadyContains);
            }
            city = Mapper.Map <City>(dto);
            repository.Add(city);
            UnitOfWork.SaveChanges();
        }
 public IHttpActionResult AddCity(AddCityDto dto)
 {
     return(CallBusinessLogicAction(() => _manager.AddCity(dto, User.Identity.GetUserId())));
 }