コード例 #1
0
        public async Task <IActionResult> PutDeliveryMethod(int id, DeliveryMethodObjectModel deliveryMethodAjax)
        {
            deliveryMethodAjax.Name = deliveryMethodAjax.Name.Trim();
            if (id != deliveryMethodAjax.Id || string.IsNullOrEmpty(deliveryMethodAjax.Name))
            {
                _logger.LogError("Запрашиваемая доставка не найдена: id={0}", id);
                return(new ObjectResult(new ServerActionResult()
                {
                    Success = false,
                    Info = "Запрашиваемая доставка не найдена",
                    Status = StylesMessageEnum.danger.ToString()
                }));
            }

            _context.Entry(deliveryMethodAjax).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                throw;
            }

            return(NoContent());
        }
コード例 #2
0
        public async Task <IQueryable <PropertyOwner> > Handle(AllOwnerListQuery request, CancellationToken cancellationToken)
        {
            var allOwners = (from o in _context.PropertyOwner
                             join op in _context.OwnerProperty on o.Id equals op.PropertyOwnerId
                             join p in _context.Property on op.PropertyId equals p.Id
                             select  new {
            }
                             );


            var owners = _context.PropertyOwner
                         .Include(a => a.Address)
                         .ToList();

            foreach (var owner in owners)
            {
                _context.Entry(owner)
                .Collection(c => c.OwnerProperty).Load();
                foreach (var op in owner.OwnerProperty)
                {
                    _context.Entry(op)
                    .Reference(o => o.Property).Load();
                }
            }



            var result = _context.PropertyOwner //;

                         .Include(op => op.OwnerProperty)
                         .ThenInclude(p => p.Property).ToList();

            return(result.AsQueryable());
            // return owners.AsQueryable();

            //throw new NotImplementedException();
        }
コード例 #3
0
        public async Task <IActionResult> PutProfile(int id, СonversationDocumentModel ajaxConversation)
        {
            if (id != ajaxConversation.Id)
            {
                return(null); // BadRequest();
            }

            _context.Entry(ajaxConversation).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                throw;
            }

            return(null); // NoContent();
        }
コード例 #4
0
        public async Task <IActionResult> PutNotification(int id, NotificationObjectModel ajaxNotification)
        {
            if (id != ajaxNotification.Id)
            {
                return(BadRequest());
            }

            _context.Entry(ajaxNotification).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                throw;
            }

            return(NoContent());
        }
コード例 #5
0
        public async Task <PropertyDetailViewModel> Handle(PropertyDetailsQuery request, CancellationToken cancellationToken)
        {
            //var ppt = _context.Property
            //    .Select(p => new
            //    {
            //        p.Id,
            //        p.PropertyName,
            //        Owners = string.Join(", ", p.OwnerProperty
            //       .Select(o => o.PropertyOwner.FirstName))

            //    }).FirstOrDefault(i => i.Id == request.Id);

            var ppt = _context.Property
                      .Include(a => a.Address)
                      .FirstOrDefault(p => p.Id == request.Id);

            _context.Entry(ppt)
            .Collection(c => c.OwnerProperty).Load();
            foreach (var op in ppt.OwnerProperty)
            {
                _context.Entry(op)
                .Reference(o => o.PropertyOwner).Load();
            }


            var prop = _context.Property
                       //.Include(c => c.ManagementContract)
                       .Include(fe => fe.Feature)
                       .Include(fa => fa.Facility)
                       .Include(a => a.Address)
                       .Include(m => m.PropertyImg)
                       .Include(op => op.OwnerProperty)
                       .ThenInclude(po => po.PropertyOwner)
                       .Where(po => po.Id == request.Id)
                       .Select(op => new PropertyDetailViewModel
            {
                PropertyName       = op.PropertyName,
                PropertyId         = op.Id,
                PropertyDesc       = op.PropertyDesc,
                PropertyLogoImgUrl = op.PropertyLogoImgUrl,
                PropertyVideoUrl   = op.PropertyVideoUrl,
                IsActive           = op.IsActive,
                IsShared           = op.IsShared,
                IsBasementSuite    = op.IsBasementSuite,
                PropertyType1      = op.Type.ToString(),
                Status             = op.Status.ToString(),
                PropertyBuildYear  = op.PropertyBuildYear,


                PropertySuiteNumber   = op.Address.PropertySuiteNumber,
                PropertyNumber        = op.Address.PropertyNumber,
                PropertyStreet        = op.Address.PropertyStreet,
                PropertyCity          = op.Address.PropertyCity,
                PropertyStateProvince = op.Address.PropertyStateProvince,
                PropertyZipPostCode   = op.Address.PropertyZipPostCode,
                PropertyCountry       = op.Address.PropertyCountry,
                GpslatitudeValue      = op.Address.GpslatitudeValue,
                GpslongitudeValue     = op.Address.GpslongitudeValue,

                NumberOfBathrooms = op.Feature.NumberOfBathrooms,
                NumberOfBedrooms  = op.Feature.NumberOfBedrooms,
                NumberOfLayers    = op.Feature.NumberOfLayers,
                NumberOfParking   = op.Feature.NumberOfParking,
                BasementAvailable = op.Feature.BasementAvailable,
                TotalLivingArea   = op.Feature.TotalLivingArea,
                FeatureNotes      = op.Feature.Notes,

                Stove           = op.Facility.Stove,
                Refrigerator    = op.Facility.Refrigerator,
                Dishwasher      = op.Facility.Dishwasher,
                Laundry         = op.Facility.Laundry,
                BlindsCurtain   = op.Facility.BlindsCurtain,
                Furniture       = op.Facility.Furniture,
                Tvinternet      = op.Facility.Tvinternet,
                CommonFacility  = op.Facility.CommonFacility,
                SecuritySystem  = op.Facility.SecuritySystem,
                UtilityIncluded = op.Facility.UtilityIncluded,
                FireAlarmSystem = op.Facility.FireAlarmSystem,
                Others          = op.Facility.Others,
                FacilityNotes   = op.Facility.Notes,

                CreationDate = op.Created.ToString("MMMM dd, yyyy"),
                UpdateDate   = op.Modified.ToString("MMMM dd, yyyy"),
                OwnerList    = op.OwnerProperty.Select(o => o.PropertyOwner).ToList(),
                ContractList = op.ManagementContract /*.Where(c =>c.IsActive == true)*/.ToList(),
                ImagetList   = op.PropertyImg.ToList()
            });
            //.FirstOrDefault(op => op.PropertyId == request.Id);


            //var pptList = (from p in _context.Property
            //               .Include(fe => fe.Feature)
            //               .Include(fa => fa.Facility)
            //               .Include(a => a.Address)
            //               .Include(m => m.PropertyImg)
            //               join op in _context.OwnerProperty on p.Id equals op.PropertyId
            //               join po in _context.PropertyOwner on op.PropertyOwnerId equals po.Id

            //               select new PropertyDetailViewModel
            //               {
            //                   PropertyName = p.PropertyName
            //               }



            //               );



            var property = _context.Property
                           .Include(c => c.ManagementContract)
                           .Include(fe => fe.Feature)
                           .Include(fa => fa.Facility)
                           .Include(a => a.Address)
                           .Include(m => m.PropertyImg)
                           .Include(op => op.OwnerProperty)
                           .ThenInclude(po => po.PropertyOwner).ToList();

            //return property.FirstOrDefault(p => p.Id == request.Id);

            return(prop.FirstOrDefault(p => p.PropertyId == request.Id));


            //throw new NotImplementedException();
        }