示例#1
0
        public bool MergeServiceType(ServiceTypeVM serviceTypeVM)
        {
            var serviceType = Map <ServiceTypeVM, ServiceType>(serviceTypeVM);
            var result      = _serviceTypes.Merge(serviceType);

            serviceTypeVM.Id = serviceType.Id;
            return(result);
        }
示例#2
0
        public async Task <IActionResult> OnGetAsync(int productPage = 1, string searchCategory = null, string searchDescription = null)
        {
            ServiceType = new ServiceTypeVM()
            {
                ServiceTypeList = (List <ServiceType>)_ServiceTypeRepo.GetAll()
            };
            StringBuilder param = BuildParameter(searchCategory, searchDescription);

            filterList(searchCategory, searchDescription);
            paginateList(productPage, param);
            return(Page());
        }
        public ActionResult <ServiceTypeVM> GetServiceTypeById(int id)
        {
            IQueryable <ServiceType> serviceTypeList = _service.GetAll(s => s.Services);
            ServiceType   serviceTypeSearch          = serviceTypeList.FirstOrDefault(s => s.Id == id);
            ServiceTypeVM rtnGallery = null;

            if (serviceTypeSearch != null)
            {
                rtnGallery = _mapper.Map <ServiceTypeVM>(serviceTypeSearch);
                return(Ok(rtnGallery));
            }
            else
            {
                return(NotFound(rtnGallery));
            }
        }
示例#4
0
        public IActionResult MergeServiceType(ServiceTypeVM serviceType)
        {
            var result  = true;
            var message = string.Empty;

            try
            {
                result = UnitOfWork.Services.MergeServiceType(serviceType);
            }
            catch (Exception ex)
            {
                result  = false;
                message = ex.ToString();
            }

            return(Json(new { result, message }));
        }
示例#5
0
        public ActionResult GetStoreByIdWithService(Guid StoreId)
        {
            var result = _serviceService.GetServices(s => s.StoreId == StoreId);
            List <ServiceVM>     listService     = result.Adapt <List <ServiceVM> >();
            List <ServiceTypeVM> listServiceType = new List <ServiceTypeVM>();

            if (listService.Any())
            {
                foreach (ServiceVM services in listService)
                {
                    ServiceTypeVM serviceTypes = _serviceTypeService.GetServiceType(services.ServiceTypeId).Adapt <ServiceTypeVM>();
                    bool          flag         = false;
                    foreach (ServiceTypeVM temp in listServiceType)
                    {
                        if (temp.Id == serviceTypes.Id)
                        {
                            flag = true;
                        }
                    }
                    if (!flag)
                    {
                        serviceTypes.listService = new List <ServiceVM>();
                        serviceTypes.listService.Add(services);
                        listServiceType.Add(serviceTypes);
                    }
                    else
                    {
                        foreach (ServiceTypeVM temp in listServiceType)
                        {
                            if (temp.Id == serviceTypes.Id)
                            {
                                temp.listService.Add(services.Adapt <ServiceVM>());
                            }
                        }
                    }
                }
            }
            var     stores = _storeService.GetStore(StoreId);
            StoreVM store  = stores.Adapt <StoreVM>();

            store.ServiceTypes = listServiceType;
            return(Ok(store));
        }
示例#6
0
        public ActionResult GetByStore(Guid StoreId)
        {
            var result = _serviceService.GetServices(s => s.StoreId == StoreId && !s.IsDelete);
            List <ServiceVM>     listService     = result.Adapt <List <ServiceVM> >();
            List <ServiceTypeVM> listServiceType = new List <ServiceTypeVM>();

            if (listService.Any())
            {
                foreach (ServiceVM services in listService)
                {
                    ServiceTypeVM serviceTypes = _serviceTypeService.GetServiceType(services.ServiceTypeId).Adapt <ServiceTypeVM>();
                    bool          flag         = false;
                    foreach (ServiceTypeVM temp in listServiceType)
                    {
                        if (temp.Id == serviceTypes.Id)
                        {
                            flag = true;
                        }
                    }
                    if (!flag)
                    {
                        serviceTypes.listService = new List <ServiceVM>();
                        serviceTypes.listService.Add(services);
                        listServiceType.Add(serviceTypes);
                    }
                    else
                    {
                        foreach (ServiceTypeVM temp in listServiceType)
                        {
                            if (temp.Id == serviceTypes.Id)
                            {
                                temp.listService.Add(services.Adapt <ServiceVM>());
                            }
                        }
                    }
                }
            }
            return(Ok(listServiceType));
        }