Esempio n. 1
0
        private async Task IsReapited(TuristPlaceCategory turistPlaceCategory)
        {
            var alltristplacecategory = await TuristPlaceCategoryRepository.GetAll();

            var reapit = alltristplacecategory.Find(a => a.TuristPlaceId == turistPlaceCategory.TuristPlaceId &&
                                                    a.CategoryId == turistPlaceCategory.CategoryId);

            if (reapit != null)
            {
                throw new ReapitException("this relation already exist");
            }
        }
Esempio n. 2
0
        public async Task <string> Register(RegisterInputDto registerinput)
        {
            var findplace = await FindPlace(registerinput.TuristPlace);

            var findcategory = await FindCategory(registerinput.Category);

            var newregister = new TuristPlaceCategory()
            {
                CategoryId    = findcategory.Id,
                TuristPlaceId = findplace.Id
            };

            await IsReapited(newregister);

            TuristPlaceCategoryRepository.Insert(newregister);
            await TuristPlaceCategoryRepository.Save();

            return("we add your relation");
        }