Пример #1
0
 public Store_StorePersonnelDTO(StorePersonnel StorePersonnel)
 {
     this.Id       = StorePersonnel.Id;
     this.Name     = StorePersonnel.Name;
     this.Quantity = StorePersonnel.Quantity;
     this.StoreId  = StorePersonnel.StoreId;
     this.Store    = StorePersonnel.Store == null ? null : new Store_StoreDTO(StorePersonnel.Store);
     this.Errors   = StorePersonnel.Errors;
 }
Пример #2
0
        public async Task <StorePersonnel> Get(long Id)
        {
            StorePersonnel StorePersonnel = await DataContext.StorePersonnel.AsNoTracking()
                                            .Where(x => x.Id == Id)
                                            .Select(x => new StorePersonnel()
            {
                Id       = x.Id,
                Name     = x.Name,
                Quantity = x.Quantity,
                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 (StorePersonnel == null)
            {
                return(null);
            }

            return(StorePersonnel);
        }
Пример #3
0
        public async Task <bool> Create(StorePersonnel StorePersonnel)
        {
            StorePersonnelDAO StorePersonnelDAO = new StorePersonnelDAO();

            StorePersonnelDAO.Id       = StorePersonnel.Id;
            StorePersonnelDAO.Name     = StorePersonnel.Name;
            StorePersonnelDAO.Quantity = StorePersonnel.Quantity;
            StorePersonnelDAO.StoreId  = StorePersonnel.StoreId;
            DataContext.StorePersonnel.Add(StorePersonnelDAO);
            await DataContext.SaveChangesAsync();

            StorePersonnel.Id = StorePersonnelDAO.Id;
            await SaveReference(StorePersonnel);

            return(true);
        }
Пример #4
0
        public async Task <bool> Update(StorePersonnel StorePersonnel)
        {
            StorePersonnelDAO StorePersonnelDAO = DataContext.StorePersonnel.Where(x => x.Id == StorePersonnel.Id).FirstOrDefault();

            if (StorePersonnelDAO == null)
            {
                return(false);
            }
            StorePersonnelDAO.Id       = StorePersonnel.Id;
            StorePersonnelDAO.Name     = StorePersonnel.Name;
            StorePersonnelDAO.Quantity = StorePersonnel.Quantity;
            StorePersonnelDAO.StoreId  = StorePersonnel.StoreId;
            await DataContext.SaveChangesAsync();

            await SaveReference(StorePersonnel);

            return(true);
        }
Пример #5
0
 private async Task SaveReference(StorePersonnel StorePersonnel)
 {
 }
Пример #6
0
        public async Task <bool> Delete(StorePersonnel StorePersonnel)
        {
            await DataContext.StorePersonnel.Where(x => x.Id == StorePersonnel.Id).DeleteFromQueryAsync();

            return(true);
        }