public async Task <IActionResult> Create([Bind("Id,Name,NumberCAS,HazardClass,MaximumPermissibleConcentrationOneTimeMaximum,MaximumPermissibleConcentrationDailyAverage,ApproximateSafeExposureLevel")] AirContaminant airContaminant)
        {
            if (ModelState.IsValid)
            {
                HttpResponseMessage response = await _HttpApiClient.PostAsJsonAsync(
                    "api/AirContaminants", 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));
                }

                return(RedirectToAction(nameof(Index)));
            }
            return(View(airContaminant));
        }
Пример #2
0
        public async Task <IActionResult> Create([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 (ModelState.IsValid)
            {
                HttpResponseMessage response = await _HttpApiClient.PostAsJsonAsync(
                    "api/AirContaminantsKK", 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));
                }

                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> Create([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 (ModelState.IsValid)
            {
                HttpResponseMessage response = await _HttpApiClient.PostAsJsonAsync(
                    "api/cato", 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));
                }

                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> Create([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 (ModelState.IsValid)
            {
                HttpResponseMessage response = await _HttpApiClient.PostAsJsonAsync(
                    "api/CompaniesKK", 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));
                }

                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));
        }