Esempio n. 1
0
        public ActionResult Detail(int id)
        {
            var shop     = _branchOfficeService.GetById(id);
            var shopForm = BranchOfficeForm.FromBranchOffice(shop);

            return(View(shopForm));
        }
Esempio n. 2
0
        public IActionResult GetOfficeById(int id)
        {
            var exists = _branchOfficeService.OfficeExists(id);

            if (exists)
            {
                var office = _branchOfficeService.GetById(id);
                return(Ok(office));
            }
            else
            {
                return(NotFound());
            }
        }
Esempio n. 3
0
        public bool IsBenefitAvailableForBranchOffice(int benefitId, int branchOfficeId)
        {
            var benefit      = Uow.Benefits.Get(b => b.Id == benefitId, b => b.BenefitBranchOffices);
            var branchOffice = _branchOfficeService.GetById(branchOfficeId);

            if (benefit == null || branchOffice == null)
            {
                throw new NotFoundException("No se encontro el beneficio");
            }

            if (!_branchOfficeService.GetByShopId(branchOffice.Shop.Id).Any())
            {
                return(false);
            }

            return(benefit.BenefitBranchOffices.Any(bo => bo.BranchOfficeId == branchOfficeId));
        }