Example #1
0
        public IActionResult ServiceInfo(int serviceId)
        {
            #region ServiceData
            int langId = 1;

            if (Request.Cookies["LangKey"] != null)
            {
                langId = Convert.ToInt32(Request.Cookies["LangKey"]);
            }
            OurServicesDTO prms    = new OurServicesDTO();
            ServiceInfo    service = new ServiceInfo();
            Task           tsk1    = Task.Factory.StartNew(() =>
            {
                prms = new ServiceNode <object, OurServicesDTO>(_fc)
                       .GetClient("/api/v1/OurServices/OurServicesGetById/" + serviceId + "/" + langId).Data;
            });
            Task tsk2 = Task.Factory.StartNew(() =>
            {
                service = new ServiceNode <object, ServiceInfo>(_fc)
                          .GetClient("/api/v1/serviceinfo/get/" + serviceId + "/" + langId).Data;
            });
            Parallel.Invoke();
            tsk1.Wait();
            tsk2.Wait();
            ServiceInfoViewModel model = new ServiceInfoViewModel();
            model.ServiceInfo   = service;
            model.ServiceParams = prms;
            #endregion
            return(View("ServiceInfo", model));
        }
Example #2
0
 public async Task <bool> UpdateServiceInfoAsync(ServiceInfoViewModel entity, int serviceId)
 {
     if (await _serviceInfoRepository.Update(_mapper.Map <ServiceInfoViewModel, ServiceInfo>(entity)))
     {
         return(await Task.FromResult(true));
     }
     else
     {
         return(await Task.FromResult(false));
     }
 }
Example #3
0
        public async Task <int> AddServiceInfoAsync(ServiceInfoViewModel entity)
        {
            if (await _serviceInfoRepository.Insert(_mapper.Map <ServiceInfoViewModel, ServiceInfo>(entity)))
            {
                var info = await _serviceInfoRepository.WhereAsync(e => e.UserId == entity.UserId);

                if (info.Any())
                {
                    return(info.FirstOrDefault()
                           .ServiceInfoId);
                }
                else
                {
                    return(0);
                }
            }
            else
            {
                return(0);
            }
        }
 public async Task <JsonResult> PutInfo(int id, ServiceInfoViewModel entity)
 {
     return(Json(await _generalInfoService.UpdateServiceInfoAsync(entity, id)));
 }
        public async Task <ActionResult <ServiceInfoViewModel> > PostInfo(ServiceInfoViewModel entity)
        {
            var id = await _generalInfoService.AddServiceInfoAsync(entity);

            return(CreatedAtAction("PostInfo", new { id = id }, entity));
        }
Example #6
0
 internal void UpdateDataContext(DataModel.Model.PlacesModel model)
 {
     DataContext = _vm = new ServiceInfoViewModel(model);
 }
Example #7
0
 public ServiceInfoRating()
 {
     this.InitializeComponent();
     _vm = DataContext as ServiceInfoViewModel;
     toggleButton.Click += toggleButton_Checked;
 }