Example #1
0
        public IActionResult OnGetLoadShowroom()
        {
            var showroom = _showRoomAddressRepository.GetAll();

            if (showroom != null)
            {
                Showrooms = new List <ShowRoomAddress>();
                var items = showroom.Where(cd => cd.IsDeleted == false).ToList();

                if (items.Count > 0)
                {
                    foreach (var item in items)
                    {
                        var showrooms = new ShowRoomAddress
                        {
                            Id       = item.Id,
                            Province = _provinceRepository.Find(cd => cd.Id == item.ProvinceId && cd.IsDeleted == false),
                            District = _districtRepository.Find(cd => cd.Id == item.DistrictId && cd.IsDeleted == false),
                            Ward     = _wardRepository.Find(cd => cd.Id == item.WardId && cd.IsDeleted == false),
                            Detail   = item.Detail,
                        };
                        Showrooms.Add(showrooms);
                    }
                }
            }
            return(new OkObjectResult(Showrooms));
        }