private static RetailerInfoResultSet GetStoreDetails(Seller seller) { var retailerInfo = new RetailerInfoResultSet { StoreId = seller.StoreId, StoreName = seller.StoreName, Description = seller.Description }; retailerInfo.Branches = new List <BranchResults>(); List <SellerBranch> sellerBranches = seller.Branches.ToList <SellerBranch>(); foreach (SellerBranch branch in sellerBranches) { BranchResults newBranch = new BranchResults(); newBranch.BranchId = branch.BranchId; newBranch.BranchName = branch.BranchName; newBranch.Address1 = branch.Address1; newBranch.Address2 = branch.Address2; newBranch.City = branch.City; newBranch.State = branch.State; newBranch.PostalCode = branch.PostalCode; newBranch.PhoneNumber = branch.PhoneNumber; newBranch.Email = branch.Email; newBranch.EnableBuy = branch.EnableBuy; newBranch.Latitude = branch.Latitude; newBranch.Longitude = branch.Longitude; retailerInfo.Branches.Add(newBranch); } return(retailerInfo); }
public BranchResults GetStoreDetails(string username, int branchId) { BranchResults branchDetails = new BranchResults(); UserService userService = new UserService(); if (userService.CheckUserExist(username)) { var currentUser = ClaimsPrincipal.Current.Identity.Name; if (username == currentUser) { var retailer = _unitOfWork.SellerRepository.GetRetailerInfo(currentUser); branchDetails = retailer.Branches.Where(x => x.BranchId == branchId).FirstOrDefault(); } } return(branchDetails); }