public async Task <IActionResult> Delete(int?id, string Search, string SortOrder, 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 == null) { return(NotFound()); } CompanyKK companyKK = null; HttpResponseMessage response = await _HttpApiClient.GetAsync($"api/CompaniesKK/{id.ToString()}"); if (response.IsSuccessStatusCode) { companyKK = await response.Content.ReadAsAsync <CompanyKK>(); } if (companyKK == null) { return(NotFound()); } return(View(companyKK)); }
public async Task <IActionResult> PutCompanyKK([FromRoute] int id, [FromBody] CompanyKK companyKK) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != companyKK.Id) { return(BadRequest()); } _context.Entry(companyKK).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CompanyKKExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostCompanyKK([FromBody] CompanyKK companyKK) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.CompanyKK.Add(companyKK); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCompanyKK", new { id = companyKK.Id }, companyKK)); }
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)); }