public Store_StoreWarrantyServiceDTO(StoreWarrantyService StoreWarrantyService)
 {
     this.Id      = StoreWarrantyService.Id;
     this.Name    = StoreWarrantyService.Name;
     this.Detail  = StoreWarrantyService.Detail;
     this.StoreId = StoreWarrantyService.StoreId;
 }
Esempio n. 2
0
        public async Task <StoreWarrantyService> Get(long Id)
        {
            StoreWarrantyService StoreWarrantyService = await DataContext.StoreWarrantyService.AsNoTracking()
                                                        .Where(x => x.Id == Id)
                                                        .Select(x => new StoreWarrantyService()
            {
                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 (StoreWarrantyService == null)
            {
                return(null);
            }

            return(StoreWarrantyService);
        }
Esempio n. 3
0
        public async Task <bool> Create(StoreWarrantyService StoreWarrantyService)
        {
            StoreWarrantyServiceDAO StoreWarrantyServiceDAO = new StoreWarrantyServiceDAO();

            StoreWarrantyServiceDAO.Id      = StoreWarrantyService.Id;
            StoreWarrantyServiceDAO.Name    = StoreWarrantyService.Name;
            StoreWarrantyServiceDAO.Detail  = StoreWarrantyService.Detail;
            StoreWarrantyServiceDAO.StoreId = StoreWarrantyService.StoreId;
            DataContext.StoreWarrantyService.Add(StoreWarrantyServiceDAO);
            await DataContext.SaveChangesAsync();

            StoreWarrantyService.Id = StoreWarrantyServiceDAO.Id;
            await SaveReference(StoreWarrantyService);

            return(true);
        }
Esempio n. 4
0
        public async Task <bool> Update(StoreWarrantyService StoreWarrantyService)
        {
            StoreWarrantyServiceDAO StoreWarrantyServiceDAO = DataContext.StoreWarrantyService.Where(x => x.Id == StoreWarrantyService.Id).FirstOrDefault();

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

            await SaveReference(StoreWarrantyService);

            return(true);
        }
Esempio n. 5
0
 private async Task SaveReference(StoreWarrantyService StoreWarrantyService)
 {
 }
Esempio n. 6
0
        public async Task <bool> Delete(StoreWarrantyService StoreWarrantyService)
        {
            await DataContext.StoreWarrantyService.Where(x => x.Id == StoreWarrantyService.Id).DeleteFromQueryAsync();

            return(true);
        }