public PartnerPartnerFamiliesResponse Delete(PartnerPartnerFamilies request)
        {
            Bm2s.Data.Common.BLL.Partner.PartnerPartnerFamily item = Datas.Instance.DataStorage.PartnerPartnerFamilies[request.PartnerPartnerFamily.Id];
              Datas.Instance.DataStorage.PartnerPartnerFamilies.Remove(item);

              PartnerPartnerFamiliesResponse response = new PartnerPartnerFamiliesResponse();
              response.PartnerPartnerFamilies.Add(request.PartnerPartnerFamily);
              return response;
        }
        public PartnerPartnerFamiliesResponse Get(PartnerPartnerFamilies request)
        {
            PartnerPartnerFamiliesResponse response = new PartnerPartnerFamiliesResponse();
              List<Bm2s.Data.Common.BLL.Partner.PartnerPartnerFamily> items = new List<Data.Common.BLL.Partner.PartnerPartnerFamily>();
              if (!request.Ids.Any())
              {
            items.AddRange(Datas.Instance.DataStorage.PartnerPartnerFamilies.Where(item =>
              (request.PartnerId == 0 || item.PartnerId == request.PartnerId) &&
              (request.PartnerFamilyId == 0 || item.PartnerFamilyId == request.PartnerFamilyId)
              ));
              }
              else
              {
            items.AddRange(Datas.Instance.DataStorage.PartnerPartnerFamilies.Where(item => request.Ids.Contains(item.Id)));
              }

              var collection = (from item in items
                        select new Bm2s.Poco.Common.Partner.PartnerPartnerFamily()
                        {
                          Id = item.Id,
                          Partner = new PartnersService().Get(new Partners() { Ids = new List<int>() { item.PartnerId } }).Partners.FirstOrDefault(),
                          PartnerFamily = new PartnerFamiliesService().Get(new PartnerFamilies() { Ids = new List<int>() { item.PartnerFamilyId } }).PartnerFamilies.FirstOrDefault()
                        }).AsQueryable().OrderBy(request.Order, !request.DescendingOrder);

              response.ItemsCount = collection.Count();
              if (request.PageSize > 0)
              {
            response.PartnerPartnerFamilies.AddRange(collection.Skip((request.CurrentPage - 1) * request.PageSize).Take(request.PageSize));
              }
              else
              {
            response.PartnerPartnerFamilies.AddRange(collection);
              }

              try
              {
            response.PagesCount = collection.Count() / response.PartnerPartnerFamilies.Count + (collection.Count() % response.PartnerPartnerFamilies.Count > 0 ? 1 : 0);
              }
              catch
              {
            response.PagesCount = 1;
              }

              return response;
        }
 public void Post()
 {
     this.Response = this.ConnectorHelper.Post(this.Request);
       this.IsFilled = true;
 }
 public void Delete()
 {
     this.Response = this.ConnectorHelper.Delete(this.Request);
       this.IsFilled = true;
 }
        public PartnerPartnerFamiliesResponse Post(PartnerPartnerFamilies request)
        {
            if (request.PartnerPartnerFamily.Id > 0)
              {
            Bm2s.Data.Common.BLL.Partner.PartnerPartnerFamily item = Datas.Instance.DataStorage.PartnerPartnerFamilies[request.PartnerPartnerFamily.Id];
            item.PartnerFamilyId = request.PartnerPartnerFamily.PartnerFamily.Id;
            item.PartnerId = request.PartnerPartnerFamily.Partner.Id;
            Datas.Instance.DataStorage.PartnerPartnerFamilies[request.PartnerPartnerFamily.Id] = item;
              }
              else
              {
            Bm2s.Data.Common.BLL.Partner.PartnerPartnerFamily item = new Data.Common.BLL.Partner.PartnerPartnerFamily()
            {
              PartnerFamilyId = request.PartnerPartnerFamily.PartnerFamily.Id,
              PartnerId = request.PartnerPartnerFamily.Partner.Id
            };

            Datas.Instance.DataStorage.PartnerPartnerFamilies.Add(item);
            request.PartnerPartnerFamily.Id = item.Id;
              }

              PartnerPartnerFamiliesResponse response = new PartnerPartnerFamiliesResponse();
              response.PartnerPartnerFamilies.Add(request.PartnerPartnerFamily);
              return response;
        }