Beispiel #1
0
 public Store_StoreCoverageCapacityDTO(StoreCoverageCapacity StoreCoverageCapacity)
 {
     this.Id      = StoreCoverageCapacity.Id;
     this.Name    = StoreCoverageCapacity.Name;
     this.Detail  = StoreCoverageCapacity.Detail;
     this.StoreId = StoreCoverageCapacity.StoreId;
 }
        public async Task <StoreCoverageCapacity> Get(long Id)
        {
            StoreCoverageCapacity StoreCoverageCapacity = await DataContext.StoreCoverageCapacity.AsNoTracking()
                                                          .Where(x => x.Id == Id)
                                                          .Select(x => new StoreCoverageCapacity()
            {
                Id      = x.Id,
                Name    = x.Name,
                Detail  = x.Detail,
                StoreId = x.StoreId,
                Store   = x.Store == null ? null : new Store
                {
                    Id                = x.Store.Id,
                    Code              = x.Store.Code,
                    CodeDraft         = x.Store.CodeDraft,
                    Name              = x.Store.Name,
                    UnsignName        = x.Store.UnsignName,
                    ParentStoreId     = x.Store.ParentStoreId,
                    OrganizationId    = x.Store.OrganizationId,
                    StoreTypeId       = x.Store.StoreTypeId,
                    StoreGroupingId   = x.Store.StoreGroupingId,
                    Telephone         = x.Store.Telephone,
                    ProvinceId        = x.Store.ProvinceId,
                    DistrictId        = x.Store.DistrictId,
                    WardId            = x.Store.WardId,
                    Address           = x.Store.Address,
                    UnsignAddress     = x.Store.UnsignAddress,
                    DeliveryAddress   = x.Store.DeliveryAddress,
                    Latitude          = x.Store.Latitude,
                    Longitude         = x.Store.Longitude,
                    DeliveryLatitude  = x.Store.DeliveryLatitude,
                    DeliveryLongitude = x.Store.DeliveryLongitude,
                    OwnerName         = x.Store.OwnerName,
                    OwnerPhone        = x.Store.OwnerPhone,
                    OwnerEmail        = x.Store.OwnerEmail,
                    TaxCode           = x.Store.TaxCode,
                    LegalEntity       = x.Store.LegalEntity,
                    AppUserId         = x.Store.AppUserId,
                    StatusId          = x.Store.StatusId,
                    RowId             = x.Store.RowId,
                    Used              = x.Store.Used,
                    StoreStatusId     = x.Store.StoreStatusId,
                },
            }).FirstOrDefaultAsync();

            if (StoreCoverageCapacity == null)
            {
                return(null);
            }

            return(StoreCoverageCapacity);
        }
        public async Task <bool> Create(StoreCoverageCapacity StoreCoverageCapacity)
        {
            StoreCoverageCapacityDAO StoreCoverageCapacityDAO = new StoreCoverageCapacityDAO();

            StoreCoverageCapacityDAO.Id      = StoreCoverageCapacity.Id;
            StoreCoverageCapacityDAO.Name    = StoreCoverageCapacity.Name;
            StoreCoverageCapacityDAO.Detail  = StoreCoverageCapacity.Detail;
            StoreCoverageCapacityDAO.StoreId = StoreCoverageCapacity.StoreId;
            DataContext.StoreCoverageCapacity.Add(StoreCoverageCapacityDAO);
            await DataContext.SaveChangesAsync();

            StoreCoverageCapacity.Id = StoreCoverageCapacityDAO.Id;
            await SaveReference(StoreCoverageCapacity);

            return(true);
        }
        public async Task <bool> Update(StoreCoverageCapacity StoreCoverageCapacity)
        {
            StoreCoverageCapacityDAO StoreCoverageCapacityDAO = DataContext.StoreCoverageCapacity.Where(x => x.Id == StoreCoverageCapacity.Id).FirstOrDefault();

            if (StoreCoverageCapacityDAO == null)
            {
                return(false);
            }
            StoreCoverageCapacityDAO.Id      = StoreCoverageCapacity.Id;
            StoreCoverageCapacityDAO.Name    = StoreCoverageCapacity.Name;
            StoreCoverageCapacityDAO.Detail  = StoreCoverageCapacity.Detail;
            StoreCoverageCapacityDAO.StoreId = StoreCoverageCapacity.StoreId;
            await DataContext.SaveChangesAsync();

            await SaveReference(StoreCoverageCapacity);

            return(true);
        }
 private async Task SaveReference(StoreCoverageCapacity StoreCoverageCapacity)
 {
 }
        public async Task <bool> Delete(StoreCoverageCapacity StoreCoverageCapacity)
        {
            await DataContext.StoreCoverageCapacity.Where(x => x.Id == StoreCoverageCapacity.Id).DeleteFromQueryAsync();

            return(true);
        }