示例#1
0
        public ActionResult Edit(Guid id)
        {
            var branch          = branchService.Find(id);
            var branchViewModel = Mapper.Map <BranchViewModel>(branch);

            if (branchViewModel == null)
            {
                return(HttpNotFound());
            }
            return(View(branchViewModel));
        }
示例#2
0
        public BranchDto GetBranch(long branchId)
        {
            var branch = _branchService.Find(branchId);

            if (branch == null)
            {
                throw new NotFoundException(ErrorCodes.BranchNotFound);
            }
            if (branch.IsDeleted)
            {
                throw new NotFoundException(ErrorCodes.BranchDeleted);
            }
            //return Mapper.Map<Branch,BranchDto>(branch, opt =>
            //{
            //    opt.BeforeMap((src, dest) =>
            //        {
            //            src.BranchTranslations = src.BranchTranslations
            //                .Where(x => x.Language.ToLower() == language.ToLower())
            //                .ToList();
            //        }
            //    );
            //});
            return(Mapper.Map <BranchDto>(branch));
        }
示例#3
0
 public IActionResult OnGet()
 {
     if (Id.HasValue)
     {
         var getBranch = branchService.Find(Id.Value);
         employees = employeeService.GetAllAsync().Result.Where(x => x.BranchId == Id.Value).ToList();
         if (getBranch != null)
         {
             viewContent.BranchName   = getBranch.Name;
             viewContent.BusnissId    = getBranch.BusinessId;
             viewContent.BusinessName = getBranch.Business.Name;
             viewContent.BranchId     = getBranch.Id;
             return(null);
         }
         RedirectToPage("/Index");
     }
     return(RedirectToPage("/Index"));
 }
 public IEnumerable <Branch> Find(Expression <Func <Branch, bool> > predicate, bool @readonly = false)
 {
     return(_service.Find(predicate, @readonly));
 }
示例#5
0
 public FindBranchesResponse Get(FindBranchesRequest request)
 {
     return(_branchService.Find(request));
 }