public async Task <IActionResult> Edit(int id, [Bind("Id,Name,NumberCAS,HazardClass,MaximumPermissibleConcentrationOneTimeMaximum,MaximumPermissibleConcentrationDailyAverage,ApproximateSafeExposureLevel")] AirContaminant airContaminant)
        {
            if (id != airContaminant.Id)
            {
                return(NotFound());
            }
            if (ModelState.IsValid)
            {
                HttpResponseMessage response = await _HttpApiClient.PutAsJsonAsync(
                    $"api/AirContaminants/{airContaminant.Id}", airContaminant);

                string OutputViewText = await response.Content.ReadAsStringAsync();

                OutputViewText = OutputViewText.Replace("<br>", Environment.NewLine);
                try
                {
                    response.EnsureSuccessStatusCode();
                }
                catch
                {
                    dynamic errors = JsonConvert.DeserializeObject <dynamic>(OutputViewText);
                    foreach (Newtonsoft.Json.Linq.JProperty property in errors.Children())
                    {
                        ModelState.AddModelError(property.Name, property.Value[0].ToString());
                    }
                    return(View(airContaminant));
                }

                airContaminant = await response.Content.ReadAsAsync <AirContaminant>();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(airContaminant));
        }
예제 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,NumberCAS,Formula,MaximumPermissibleConcentrationOneTimeMaximum,MaximumPermissibleConcentrationDailyAverage,HazardClass,Code,ApproximateSafeExposureLevel")] AirContaminantKK airContaminantKK,
                                               string SortOrder,
                                               string NameFilter,
                                               string NumberCASFilter,
                                               string FormulaFilter,
                                               decimal?MaximumPermissibleConcentrationOneTimeMaximumFilter,
                                               decimal?MaximumPermissibleConcentrationDailyAverageFilter,
                                               int?HazardClassFilter,
                                               int?CodeFilter,
                                               decimal?ApproximateSafeExposureLevelFilter,
                                               int?PageSize,
                                               int?Page)
        {
            ViewBag.SortOrder       = SortOrder;
            ViewBag.PageSize        = PageSize;
            ViewBag.Page            = Page;
            ViewBag.NameFilter      = NameFilter;
            ViewBag.NumberCASFilter = NumberCASFilter;
            ViewBag.FormulaFilter   = FormulaFilter;
            ViewBag.MaximumPermissibleConcentrationOneTimeMaximumFilter = MaximumPermissibleConcentrationOneTimeMaximumFilter;
            ViewBag.MaximumPermissibleConcentrationDailyAverageFilter   = MaximumPermissibleConcentrationDailyAverageFilter;
            ViewBag.HazardClassFilter = HazardClassFilter;
            ViewBag.CodeFilter        = CodeFilter;
            ViewBag.ApproximateSafeExposureLevelFilter = ApproximateSafeExposureLevelFilter;
            if (id != airContaminantKK.Id)
            {
                return(NotFound());
            }
            if (ModelState.IsValid)
            {
                HttpResponseMessage response = await _HttpApiClient.PutAsJsonAsync(
                    $"api/AirContaminantsKK/{airContaminantKK.Id}", airContaminantKK);

                string OutputViewText = await response.Content.ReadAsStringAsync();

                OutputViewText = OutputViewText.Replace("<br>", Environment.NewLine);
                try
                {
                    response.EnsureSuccessStatusCode();
                }
                catch
                {
                    dynamic errors = JsonConvert.DeserializeObject <dynamic>(OutputViewText);
                    foreach (Newtonsoft.Json.Linq.JProperty property in errors.Children())
                    {
                        ModelState.AddModelError(property.Name, property.Value[0].ToString());
                    }
                    return(View(airContaminantKK));
                }

                airContaminantKK = await response.Content.ReadAsAsync <AirContaminantKK>();

                return(RedirectToAction(nameof(Index), new { PageSize = ViewBag.PageSize, Page = ViewBag.Page, SortOrder = ViewBag.SortOrder, NameFilter = ViewBag.NameFilter, NumberCASFilter = ViewBag.NumberCASFilter, FormulaFilter = ViewBag.FormulaFilter, MaximumPermissibleConcentrationOneTimeMaximumFilter = ViewBag.MaximumPermissibleConcentrationOneTimeMaximumFilter, MaximumPermissibleConcentrationDailyAverageFilter = ViewBag.MaximumPermissibleConcentrationDailyAverageFilter, HazardClassFilter = ViewBag.HazardClassFilter, CodeFilter = ViewBag.CodeFilter, ApproximateSafeExposureLevelFilter = ViewBag.ApproximateSafeExposureLevelFilter }));
            }
            return(View(airContaminantKK));
        }
예제 #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Code,NameKK,NameRU,Parent,AreaType,EgovId")] CATO cato,
                                               string SortOrder,
                                               int?EgovIdFilter,
                                               string CodeFilter,
                                               string NameKKFilter,
                                               string NameRUFilter,
                                               int?ParentFilter,
                                               int?AreaTypeFilter,
                                               int?PageSize,
                                               int?Page)
        {
            ViewBag.SortOrder        = SortOrder;
            ViewBag.PageSize         = PageSize;
            ViewBag.Page             = Page;
            ViewBag.EgovIdFilter     = EgovIdFilter;
            ViewBag.CodeFilter       = CodeFilter;
            ViewBag.NameKKFilter     = NameKKFilter;
            ViewBag.PaNameRUFilterge = NameRUFilter;
            ViewBag.ParentFilter     = ParentFilter;
            ViewBag.AreaTypeFilter   = AreaTypeFilter;
            if (id != cato.Id)
            {
                return(NotFound());
            }
            if (ModelState.IsValid)
            {
                HttpResponseMessage response = await _HttpApiClient.PutAsJsonAsync(
                    $"api/cato/{cato.Id}", cato);

                string OutputViewText = await response.Content.ReadAsStringAsync();

                OutputViewText = OutputViewText.Replace("<br>", Environment.NewLine);
                try
                {
                    response.EnsureSuccessStatusCode();
                }
                catch
                {
                    dynamic errors = JsonConvert.DeserializeObject <dynamic>(OutputViewText);
                    foreach (Newtonsoft.Json.Linq.JProperty property in errors.Children())
                    {
                        ModelState.AddModelError(property.Name, property.Value[0].ToString());
                    }
                    return(View(cato));
                }

                cato = await response.Content.ReadAsAsync <CATO>();

                return(RedirectToAction(nameof(Index), new { PageSize = ViewBag.PageSize, Page = ViewBag.Page, SortOrder = ViewBag.SortOrder, EgovIdFilter = ViewBag.EgovIdFilter, CodeFilter = ViewBag.CodeFilter, NameKKFilter = ViewBag.NameKKFilter, NameRUFilter = ViewBag.NameRUFilter, ParentFilter = ViewBag.ParentFilter, AreaTypeFilter = ViewBag.AreaTypeFilter }));
            }
            return(View(cato));
        }
예제 #4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,BIN,NameKK,NameRU,DateRegister,OKED,ActivityKindKK,ActivityKindRU,OKEDSecondary,KRP,KRPNameKK,KRPNameRU,CATO,LocalityKK,LocalityRU,LegalAddress,HeadName")] CompanyKK companyKK,
                                               string SortOrder,
                                               string Search,
                                               string BINFilter,
                                               string NameKKFilter,
                                               string NameRUFilter,
                                               DateTime?DateRegisterFilter,
                                               string OKEDFilter,
                                               string ActivityKindKKFilter,
                                               string ActivityKindRUFilter,
                                               string OKEDSecondaryFilter,
                                               string KRPFilter,
                                               string KRPNameKKFilter,
                                               string KRPNameRUFilter,
                                               string CATOFilter,
                                               string LocalityKKFilter,
                                               string LocalityRUFilter,
                                               string LegalAddressFilter,
                                               string HeadNameFilter,
                                               int?PageSize,
                                               int?Page)
        {
            ViewBag.Search               = Search;
            ViewBag.SortOrder            = SortOrder;
            ViewBag.PageSize             = PageSize;
            ViewBag.Page                 = Page;
            ViewBag.BINFilter            = BINFilter;
            ViewBag.NameKKFilter         = NameKKFilter;
            ViewBag.NameRUFilter         = NameRUFilter;
            ViewBag.DateRegisterFilter   = DateRegisterFilter;
            ViewBag.OKEDFilter           = OKEDFilter;
            ViewBag.ActivityKindKKFilter = ActivityKindKKFilter;
            ViewBag.ActivityKindRUFilter = ActivityKindRUFilter;
            ViewBag.OKEDSecondaryFilter  = OKEDSecondaryFilter;
            ViewBag.KRPFilter            = KRPFilter;
            ViewBag.KRPNameKKFilter      = KRPNameKKFilter;
            ViewBag.KRPNameRUFilter      = KRPNameRUFilter;
            ViewBag.CATOFilter           = CATOFilter;
            ViewBag.LocalityKKFilter     = LocalityKKFilter;
            ViewBag.LocalityRUFilter     = LocalityRUFilter;
            ViewBag.LegalAddressFilter   = LegalAddressFilter;
            ViewBag.HeadNameFilter       = HeadNameFilter;
            if (id != companyKK.Id)
            {
                return(NotFound());
            }
            if (ModelState.IsValid)
            {
                HttpResponseMessage response = await _HttpApiClient.PutAsJsonAsync(
                    $"api/CompaniesKK/{companyKK.Id}", companyKK);

                string OutputViewText = await response.Content.ReadAsStringAsync();

                OutputViewText = OutputViewText.Replace("<br>", Environment.NewLine);
                try
                {
                    response.EnsureSuccessStatusCode();
                }
                catch
                {
                    dynamic errors = JsonConvert.DeserializeObject <dynamic>(OutputViewText);
                    foreach (Newtonsoft.Json.Linq.JProperty property in errors.Children())
                    {
                        ModelState.AddModelError(property.Name, property.Value[0].ToString());
                    }
                    return(View(companyKK));
                }

                companyKK = await response.Content.ReadAsAsync <CompanyKK>();

                return(RedirectToAction(nameof(Index), new
                {
                    PageSize = ViewBag.PageSize,
                    Search = ViewBag.Search,
                    SortOrder = ViewBag.SortOrder,
                    Page = ViewBag.Page,
                    BINFilter = ViewBag.BINFilter,
                    NameKKFilter = ViewBag.NameKKFilter,
                    NameRUFilter = ViewBag.NameRUFilter,
                    DateRegisterFilter = ViewBag.DateRegisterFilter,
                    OKEDFilter = ViewBag.OKEDFilter,
                    ActivityKindKKFilter = ViewBag.ActivityKindKKFilter,
                    ActivityKindRUFilter = ViewBag.ActivityKindRUFilter,
                    OKEDSecondaryFilter = ViewBag.OKEDSecondaryFilter,
                    KRPFilter = ViewBag.KRPFilter,
                    KRPNameKKFilter = ViewBag.KRPNameKKFilter,
                    KRPNameRUFilter = ViewBag.KRPNameRUFilter,
                    CATOFilter = ViewBag.CATOFilter,
                    LocalityKKFilter = ViewBag.LocalityKKFilter,
                    LocalityRUFilter = ViewBag.LocalityRUFilter,
                    LegalAddressFilter = ViewBag.LegalAddressFilter,
                    HeadNameFilter = ViewBag.HeadNameFilter
                }));
            }
            return(View(companyKK));
        }