コード例 #1
0
        public async Task <IViewComponentResult> InvokeAsync()
        {
            var client   = new ServiceNodeAsync <object, List <LangDTO> >(_fc);
            var services = await client.GetClientAsync("/api/lang/all");

            return(View(services.Data));
        }
コード例 #2
0
        public async Task <IActionResult> Services()
        {
            var client   = new ServiceNodeAsync <object, List <ServiceDTO> >(_fc);
            var services = await client.GetClientAsync("/api/services/services/1");

            return(View(services.Data));
        }
コード例 #3
0
        public async Task <IActionResult> Add()
        {
            #region AddData
            var client   = new ServiceNodeAsync <object, List <LangDTO> >(_fc);
            var services = await client.GetClientAsync("/api/lang/all");

            AddServiceViewModel model = new AddServiceViewModel();
            model.Langs = services.Data;
            #endregion
            return(View(model));
        }
コード例 #4
0
        public async Task <IViewComponentResult> InvokeAsync()
        {
            int langId = 1;

            if (Request.Cookies["LangKey"] != null)
            {
                langId = Convert.ToInt32(Request.Cookies["LangKey"]);
            }
            var client   = new ServiceNodeAsync <object, List <ServiceDTO> >(_fc);
            var services = await client.GetClientAsync("/api/services/services/" + langId);

            return(View(services.Data.OrderBy(a => a.Id)));
        }
コード例 #5
0
        public async Task <IActionResult> AddConfirm([FromForm] AddServiceViewModel data)
        {
            #region AddService
            var client  = new ServiceNodeAsync <object, List <LangDTO> >(_fc);
            var service = await client.GetClientAsync("/api/lang/all");

            List <LangDTO>        langs = service.Data;
            List <ServiceNameDTO> names = new List <ServiceNameDTO>();
            List <ServiceInfoDTO> infos = new List <ServiceInfoDTO>();
            AddServiceDTO         model = new AddServiceDTO();
            for (int i = 0; i < data.NumberLang; i++)
            {
                names.Add(new ServiceNameDTO
                {
                    LangId    = langs[i].Id,
                    Name      = data.Names[i],
                    ServiceId = 12
                });
                infos.Add(new ServiceInfoDTO
                {
                    LangId    = langs[i].Id,
                    Name      = data.Infos[i],
                    ServiceId = 12
                });
            }
            string pictureName = string.Empty;
            if (data.Picture != null)
            {
                pictureName = FileManager.IFormSaveLocal(data.Picture, "ServicePictures");
            }

            model.IsPayed         = data.IsPayed;
            model.ServicePictures = new ServicePictureDTO {
                Picture = pictureName, ServiceId = 12
            };
            model.ServiceNames = names;
            model.ServiceInfo  = infos;
            var req = await new ServiceNodeAsync <AddServiceDTO, object>(_localizer, _fc).PostClientAsync(model, "/api/services/add/new");
            if (req.IsCatched == 1)
            {
                return(RedirectToAction("Add"));
            }
            #endregion
            TempData["R_Message"] = "Əlavə olundu";
            return(RedirectToAction("Services", "Home", new { Area = "Admin" }));
        }