// GET: PlantationsStateTypes/Delete/5
        public async Task <IActionResult> Delete(int?id,
                                                 string SortOrder,
                                                 string NameKKFilter,
                                                 string NameRUFilter,
                                                 string NameENFilter,
                                                 int?PageSize,
                                                 int?PageNumber)
        {
            ViewBag.SortOrder    = SortOrder;
            ViewBag.PageSize     = PageSize;
            ViewBag.PageNumber   = PageNumber;
            ViewBag.NameKKFilter = NameKKFilter;
            ViewBag.NameRUFilter = NameRUFilter;
            ViewBag.NameENFilter = NameENFilter;
            if (id == null)
            {
                return(NotFound());
            }

            PlantationsStateType plantationsStateType = null;
            HttpResponseMessage  response             = await _HttpApiClient.GetAsync($"api/PlantationsStateTypes/{id.ToString()}");

            if (response.IsSuccessStatusCode)
            {
                plantationsStateType = await response.Content.ReadAsAsync <PlantationsStateType>();
            }
            if (plantationsStateType == null)
            {
                return(NotFound());
            }

            return(View(plantationsStateType));
        }
        public async Task <IActionResult> PutPlantationsStateType(int id, PlantationsStateType plantationsStateType)
        {
            if (id != plantationsStateType.Id)
            {
                return(BadRequest());
            }

            _context.Entry(plantationsStateType).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PlantationsStateTypeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,NameKK,NameRU,NameEN")] PlantationsStateType plantationsStateType,
                                               string SortOrder,
                                               string NameKKFilter,
                                               string NameRUFilter,
                                               string NameENFilter,
                                               int?PageSize,
                                               int?PageNumber)
        {
            ViewBag.SortOrder    = SortOrder;
            ViewBag.PageSize     = PageSize;
            ViewBag.PageNumber   = PageNumber;
            ViewBag.NameKKFilter = NameKKFilter;
            ViewBag.NameRUFilter = NameRUFilter;
            ViewBag.NameENFilter = NameENFilter;
            if (id != plantationsStateType.Id)
            {
                return(NotFound());
            }
            if (ModelState.IsValid)
            {
                HttpResponseMessage response = await _HttpApiClient.PutAsJsonAsync(
                    $"api/PlantationsStateTypes/{plantationsStateType.Id}", plantationsStateType);

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

                plantationsStateType = await response.Content.ReadAsAsync <PlantationsStateType>();

                return(RedirectToAction(nameof(Index),
                                        new
                {
                    SortOrder = ViewBag.SortOrder,
                    PageSize = ViewBag.PageSize,
                    PageNumber = ViewBag.PageNumber,
                    NameKKFilter = ViewBag.NameKKFilter,
                    NameRUFilter = ViewBag.NameRUFilter,
                    NameENFilter = ViewBag.NameENFilter
                }));
            }
            return(View(plantationsStateType));
        }
        public async Task <ActionResult <PlantationsStateType> > PostPlantationsStateType(PlantationsStateType plantationsStateType)
        {
            _context.PlantationsStateType.Add(plantationsStateType);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPlantationsStateType", new { id = plantationsStateType.Id }, plantationsStateType));
        }