public ActionResult Add()
        {
            var model = new ProductCategoryViewModel
            {
                IsEdit          = false,
                ListProductCate = ListCategoryProduct()
            };

            var content = _viewRenderService.RenderToStringAsync("ProductCategory/_AddEditModal", model);

            return(Json(new JsonResponse
            {
                Success = true,
                Message = Constants.GetDataSuccess,
                StatusCode = Utilities.Constants.StatusCode.GetDataSuccess,
                Data = content.Result,
            }));
        }
Beispiel #2
0
        public ActionResult Edit(int id, ProductCategoryViewModel model)
        {
            try
            {
                bool result = _productCategoryService.UpdateProductCategory(model);

                if (result)
                {
                    return(RedirectToAction(nameof(Index)));
                }
                throw new Exception();
            }
            catch
            {
                ModelState.AddModelError(string.Empty, "Ooops! Something went wrong!");
                return(View());
            }
        }
Beispiel #3
0
        public ActionResult Edit(long id)
        {
            var productCategory = productCategoryService.GetProductCategory(id);

            if (productCategory != null)
            {
                ProductCategoryViewModel productCVM = new ProductCategoryViewModel();
                productCVM.Id               = productCategory.Id;
                productCVM.Name             = productCategory.Name;
                productCVM.Slug             = productCategory.Slug;
                productCVM.Description      = productCategory.Description;
                productCVM.ParentCategoryId = productCategory.ParentCategoryId;
                ViewBag.ProductCategories   = new SelectList(productCategoryService.GetProductCategories(), "Id", "Name", productCategory.ParentCategoryId);
                return(View(productCVM));
            }

            return(RedirectToAction("Index"));
        }
        public HttpResponseMessage Update(HttpRequestMessage request, ProductCategoryViewModel productCategoryVm)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;
                if (!ModelState.IsValid)
                {
                    response = request.CreateResponse(HttpStatusCode.BadRequest, ModelState);
                }
                else
                {
                    var dbProductCategory = _productCategoryService.GetById(productCategoryVm.ID);

                    dbProductCategory.UpdateProductCategory(productCategoryVm);
                    dbProductCategory.UpdatedDate = DateTime.Now;

                    _productCategoryService.Update(dbProductCategory);
                    try
                    {
                        _productCategoryService.Save();
                    }
                    catch (DbEntityValidationException e)
                    {
                        foreach (var eve in e.EntityValidationErrors)
                        {
                            Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                              eve.Entry.Entity.GetType().Name, eve.Entry.State);
                            foreach (var ve in eve.ValidationErrors)
                            {
                                Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                                                  ve.PropertyName, ve.ErrorMessage);
                            }
                        }
                        throw;
                    }


                    var responseData = Mapper.Map <ProductCategory, ProductCategoryViewModel>(dbProductCategory);
                    response = request.CreateResponse(HttpStatusCode.Created, responseData);
                }

                return response;
            }));
        }
Beispiel #5
0
        public ActionResult Search(string keyword, int page = 1)
        {
            int pageSize = 8;

            ViewData["pageSize"] = pageSize;
            ViewBag.Keyword      = keyword;
            ProductCategoryViewModel prctViewModel = new ProductCategoryViewModel();

            //lấy ra danh sách sản phẩm theo tên
            prctViewModel.ListProductCategory = ProductService.Search(keyword);

            int totalRecord = prctViewModel.ListProductCategory.Count;

            ViewBag.TotalRecord     = totalRecord;
            prctViewModel.Index     = page;
            prctViewModel.TotalPage = (int)(Math.Ceiling(((double)totalRecord / pageSize)));

            return(View(prctViewModel));
        }
Beispiel #6
0
        public ActionResult AddProduct(int Id = 0)
        {
            if (HttpContext.Session.GetString(Constants.SessionObj.LogedInUser) != null)
            {
                User OUser = JsonConvert.DeserializeObject <User>(HttpContext.Session.GetString(Constants.SessionObj.LogedInUser));
//                MyContext db = new MyContext();
                IList <Category> allCategories = db.Category.ToList();
                ViewBag.categorylist = allCategories;
                if (!Id.Equals(0))
                {
                    ProductCategoryViewModel obj = new ProductCategoryViewModel();
                    obj.objProduct          = db.Product.Where(m => m.Id == Id).FirstOrDefault();
                    obj.objProduct.Quantity = float.Parse(obj.objProduct.GetQuantity);
                    return(View(obj));
                }
                return(View());
            }
            return(RedirectToAction("Login"));
        }
        private ActionResult ShowCategories()
        {
            List <ProductCategory> productCategories = db.ProductCategories.ToList();

            if (!productCategories.Any())
            {
                ViewBag.DefineCategory = "Proszę zdefiniować co najmniej jedną kategorię, aby móc dodać rozmiary";
                return(View("LackOfCategories"));
            }
            List <ProductCategoryViewModel> categoriesViewModel = new List <ProductCategoryViewModel>();

            foreach (ProductCategory category in productCategories)
            {
                ProductCategoryViewModel productCategoryViewModel = new ProductCategoryViewModel(category);
                categoriesViewModel.Add(productCategoryViewModel);
            }
            ViewBag.ChooseCategory = "Wybierz konkretną kategorię, aby zobaczyć rozmiary";
            return(View("ShowCategories", categoriesViewModel));
        }
Beispiel #8
0
        public IHttpActionResult Update(ProductCategoryViewModel productCategoryVm)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            else
            {
                if (productCategoryVm.ID == productCategoryVm.ParentID)
                {
                    return(BadRequest());
                }
                else
                {
                    var dbProductCategory = _productCategoryService.GetById(productCategoryVm.ID);

                    dbProductCategory.UpdateProductCategory(productCategoryVm);
                    dbProductCategory.UpdatedDate = DateTime.Now;

                    _productCategoryService.Update(dbProductCategory);
                    try
                    {
                        _productCategoryService.Save();
                    }
                    catch (DbEntityValidationException e)
                    {
                        foreach (var eve in e.EntityValidationErrors)
                        {
                            Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                              eve.Entry.Entity.GetType().Name, eve.Entry.State);
                            foreach (var ve in eve.ValidationErrors)
                            {
                                Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                                                  ve.PropertyName, ve.ErrorMessage);
                            }
                        }
                        throw;
                    }
                    var responseData = Mapper.Map <ProductCategory, ProductCategoryViewModel>(dbProductCategory);
                    return(Ok(responseData));
                }
            }
        }
        public IActionResult SaveEntity(ProductCategoryViewModel productCategoryViewModel)
        {
            if (!ModelState.IsValid)
            {
                IEnumerable <ModelError> allErrors = ModelState.Values.SelectMany(e => e.Errors);
                return(new BadRequestObjectResult(allErrors));
            }

            productCategoryViewModel.SeoAlias = TextHelper.ToUnsignString(productCategoryViewModel.Name);
            if (productCategoryViewModel.Id == 0)
            {
                ServiceRegistration.ProductCategoryService.Add(productCategoryViewModel);
            }
            else
            {
                ServiceRegistration.ProductCategoryService.Update(productCategoryViewModel);
            }
            return(new OkObjectResult(productCategoryViewModel));
        }
Beispiel #10
0
        public ProductCategoryViewModel GetProductCategoryDetails(int id)
        {
            try
            {
                ProductCategory category = _context.ProductCategory.Where(x => x.ProductCategoryId == id).FirstOrDefault();

                ProductCategoryViewModel viewModel = new ProductCategoryViewModel
                {
                    Id = category.ProductCategoryId,
                    ProductCategoryName = category.ProductCategoryName,
                };

                return(viewModel);
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #11
0
        public static void UpdateProductCategory(this ProductCategory des, ProductCategoryViewModel res)
        {
            des.ID           = res.ID;
            des.Name         = res.Name;
            des.Alias        = res.Alias;
            des.Description  = res.Description;
            des.ParentID     = res.ParentID;
            des.DisplayOrder = res.DisplayOrder;
            des.Image        = res.Image;
            des.HomeFlag     = res.HomeFlag;

            des.CreatedDate     = res.CreatedDate;
            des.CreatedBy       = res.CreatedBy;
            des.UpdatedDate     = res.UpdatedDate;
            des.UpdatedBy       = res.UpdatedBy;
            des.MetaKeyword     = res.MetaKeyword;
            des.MetaDescription = res.MetaDescription;
            des.Status          = res.Status;
        }
Beispiel #12
0
        /// <summary>
        /// Convert ProductCategoryViewModel Object into ProductCategory Entity
        /// </summary>
        ///<param name="model">ProductCategoryViewModel</param>
        ///<param name="RegionEntity">DataAccess.ProductCategory</param>
        ///<returns>DataAccess.ProductCategory</returns>
        public static DataAccess.ProductCategory ToEntity(this ProductCategoryViewModel model, DataAccess.ProductCategory entity)
        {
            if (entity.Id == 0)
            {
                entity.CreatedUserId = model.SessionUserId;
            }
            else
            {
                entity.IsActive         = model.IsActive;
                entity.UpdatedUserId    = model.SessionUserId;
                entity.UpdatedTimestamp = DateTime.Now;
            }

            entity.Name        = model.Name;
            entity.Description = model.Description;
            entity.Ordinal     = model.Ordinal;

            return(entity);
        }
        // GET: Control/ProductCategories/Details/5
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            ProductCategoryViewModel model = new ProductCategoryViewModel
            {
                ProductCategory           = await _context.ProductCategories.FirstOrDefaultAsync(x => x.Id == id),
                ProductCategoryTranslates = _context.ProductCategoryTranslates.Include("Language").Where(x => x.ProductCategoryId == id).ToList()
            };

            if (model.ProductCategory == null)
            {
                return(NotFound());
            }

            return(View(model));
        }
Beispiel #14
0
        public HttpResponseMessage Create(HttpRequestMessage request, ProductCategoryViewModel productCategoryVm)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;
                if (!ModelState.IsValid)
                {
                    request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
                }
                else
                {
                    ProductCategory productCategory = new ProductCategory();

                    // Chuyen doi du lieu tu trang view toi du lieu cua model
                    productCategory.UpdateProductCategory(productCategoryVm);

                    if (!String.IsNullOrEmpty(productCategoryVm.Image))
                    {
                        var image = ConvertData.Base64ToImage(productCategoryVm.Image);

                        productCategory.Image = productCategory.ID + "_" + productCategory.Name + ".jpg";

                        string filePath = Path.Combine(HttpContext.Current.Server.MapPath("~/fileman/Uploads/")
                                                       + CommonConstants.PathProductCategory + "/" + productCategory.Image);

                        image.Save(filePath, ImageFormat.Jpeg);
                    }

                    productCategory.CreatedDate = DateTime.Now;

                    // sau khi chuyen doi ta add du lieu
                    _productCategoryService.Add(productCategory);
                    _productCategoryService.Save();

                    //Sau khi luu xong chuyen doi lai wa du lieu cua view model de hien thi json
                    var responseData = Mapper.Map <ProductCategory, ProductCategoryViewModel>(productCategory);
                    response = request.CreateResponse(HttpStatusCode.OK, responseData);
                }

                return response;
            }));
        }
Beispiel #15
0
        public async Task <IActionResult> ViewDrink(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            var drinks = await _dbContext.Drinks.SingleOrDefaultAsync(m => m.DrinkId == id);

            if (drinks == null)
            {
                return(NotFound());
            }
            ProductCategoryViewModel PAC = new ProductCategoryViewModel()
            {
                CategoryList = await _dbContext.Categories.ToListAsync(),
                Drinks       = drinks
            };

            return(View(PAC));
        }
Beispiel #16
0
 public HttpResponseMessage Create(HttpRequestMessage request, ProductCategoryViewModel productCategoryViewModel)
 {
     return(CreateHttpResponse(request, ()
                               =>
     {
         HttpResponseMessage response = null;
         if (!ModelState.IsValid)
         {
             response = request.CreateResponse(HttpStatusCode.BadRequest, ModelState);
         }
         else
         {
             var productCategory = Mapper.Map <ProductCategoryViewModel, ProductCategory>(productCategoryViewModel);
             _productCategoryService.Add(productCategory);
             _productCategoryService.Save();
             response = request.CreateResponse(HttpStatusCode.Created, productCategoryViewModel);
         }
         return response;
     }));
 }
        public HttpResponseMessage GetById(HttpRequestMessage request, int id)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                ProductCategory productCategory = productCategoryService.GetById(id);
                if (productCategory == null)
                {
                    response = request.CreateErrorResponse(HttpStatusCode.NotFound, "Invalid Product Category.");
                }
                else
                {
                    ProductCategoryViewModel productCategoryVM = Mapper.Map <ProductCategory, ProductCategoryViewModel>(productCategory);
                    response = request.CreateResponse(HttpStatusCode.OK, productCategoryVM);
                }

                return response;
            }));
        }
        public ActionResult Create([Bind(Include = "ProductCategoryId,Name,Description,ImagePath")] ProductCategoryViewModel productCategoryViewModel)
        {
            if (ModelState.IsValid)
            {
                var myHelper  = new ControllersHelper();
                var imagePath = myHelper.SaveFile(productCategoryViewModel.ImagePath, ModelState, Server);

                ProductCategory productCategory = new ProductCategory
                {
                    Name        = productCategoryViewModel.Name,
                    Description = productCategoryViewModel.Description,
                    ImagePath   = imagePath
                };
                db.ProductCategory.Add(productCategory);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(productCategoryViewModel));
        }
Beispiel #19
0
        public ActionResult Edit(string id, ProductCategoryViewModel model)
        {
            try
            {
                var productCategory = _productCategoryService.GetByID(new Guid(id));

                productCategory.UpdateProductCategory(model);
                productCategory.UpdatedBy = User.Identity.Name;

                _productCategoryService.Update(productCategory);
                _productCategoryService.SaveChanges();
                SetAlert("Updated " + model.Name + " successfully", "success");
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("edit-category-err", ex.Message);
                return(View(model));
            }
        }
Beispiel #20
0
        public IActionResult SaveEntity(ProductCategoryViewModel productVm)
        {
            if (!ModelState.IsValid)
            {
                IEnumerable <ModelError> allErrors = ModelState.Values.SelectMany(v => v.Errors);
                return(new BadRequestObjectResult(allErrors));
            }

            productVm.SeoAlias = TextHelper.ToUnsignString(productVm.Name);
            if (productVm.Id == 0)
            {
                _productCategoryService.Add(productVm);
            }
            else
            {
                _productCategoryService.Update(productVm);
            }
            _unitOfWork.Commit();
            return(new OkObjectResult(productVm));
        }
 public HttpResponseMessage Create(HttpRequestMessage request, ProductCategoryViewModel productCategoryVm)
 {
     if (ModelState.IsValid)
     {
         return(CreateHttpResponse(request, () =>
         {
             var model = new ProductCategory();
             model.UpdateProductCategory(productCategoryVm);
             model.CreatedDate = DateTime.Now;
             _productCategoryService.Add(model);
             _productCategoryService.Save();
             var result = Mapper.Map <ProductCategory, ProductCategoryViewModel>(model);
             return request.CreateResponse(HttpStatusCode.OK, result);
         }));
     }
     else
     {
         return(request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
     }
 }
Beispiel #22
0
        public async Task <IActionResult> Edit(int?id)
        {
            var model = new ProductCategoryViewModel();

            if (id == null)
            {
                return(NotFound());
            }

            var product = await _productService.FindProductByIdAsync((int)id);

            if (product == null)
            {
                return(NotFound());
            }

            model = await FillUpProductEditData(model, product);

            return(View(model));
        }
Beispiel #23
0
        // GET: Product/Edit/5
        public ActionResult Edit(int?id)
        {
            var Categories = db.categories.ToList();
            ProductCategoryViewModel pcvm = new ProductCategoryViewModel
            {
                Categories = Categories
            };

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Product product = db.products.Find(id);

            if (product == null)
            {
                return(HttpNotFound());
            }
            return(View(pcvm));
        }
Beispiel #24
0
        public HttpResponseMessage Update(HttpRequestMessage request, ProductCategoryViewModel productCategoryVM)
        {
            HttpResponseMessage response = null;

            if (ModelState.IsValid)
            {
                var DbProductCategory = _productCategoryService.GetById(productCategoryVM.ID);
                DbProductCategory.UpdateProductCategory(productCategoryVM);
                DbProductCategory.UpdatedDate = DateTime.Now;
                _productCategoryService.Update(DbProductCategory);
                _productCategoryService.Save();
                var responseData = Mapper.Map <ProductCategory, ProductCategory>(DbProductCategory);
                response = request.CreateResponse(HttpStatusCode.Created, responseData);
            }
            else
            {
                response = request.CreateResponse(HttpStatusCode.BadRequest, ModelState);
            }
            return(response);
        }
 public HttpResponseMessage Post(HttpRequestMessage request, ProductCategoryViewModel productCategoryVM)
 {
     return(CreateHttpResponse(request, () =>
     {
         HttpResponseMessage response = null;
         if (!ModelState.IsValid)
         {
             request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
         }
         else
         {
             ProductCategory newProductCategory = new ProductCategory();
             newProductCategory.UpdateProductCategory(productCategoryVM);
             var category = _productCategoryService.Add(newProductCategory);
             _productCategoryService.SaveChanges();
             response = request.CreateResponse(HttpStatusCode.Created, category);
         }
         return response;
     }));
 }
Beispiel #26
0
        public ActionResult Add(ProductCategoryViewModel model)
        {
            try
            {
                if (model.ImageUpload == null)
                {
                    ModelState.AddModelError("Icon", "Icon không được bỏ trống");
                }

                if (ModelState.IsValid)
                {
                    if (model.ImageUpload != null)
                    {
                        string fileName = Path.GetFileNameWithoutExtension(model.ImageUpload.FileName);

                        string extension = Path.GetExtension(model.ImageUpload.FileName);

                        model.Icon = fileName + extension;

                        model.ImageUpload.SaveAs(Path.Combine(Server.MapPath("~/Assets/Admin/images/MyImages/ProductCategory/"), model.Icon));

                        var productCategory = AutoMapper.Mapper.Map <ProductCategory>(model);
                        productCategory.CreatedBy   = "";
                        productCategory.CreatedDate = DateTime.Now;
                        productCategory.Status      = true;
                        productCategory.UpdateBy    = "";
                        productCategory.UpdatedDate = DateTime.Now;

                        _productCategoryService.Insert(productCategory);
                        _productCategoryService.SaveChanges();

                        return(RedirectToAction("Index", "ProductCategory"));
                    }
                }
            }
            catch (Exception)
            {
                return(View(model));
            }
            return(View(model));
        }
 public HttpResponseMessage Update(HttpRequestMessage request, ProductCategoryViewModel productCategoryVm)
 {
     if (ModelState.IsValid)
     {
         return(CreateHttpResponse(request, () =>
         {
             if (productCategoryVm.ID == productCategoryVm.ParentID)
             {
                 return request.CreateErrorResponse(HttpStatusCode.BadRequest, "Danh mục này không thể làm danh mục con chính nó");
             }
             var model = _productCategoryService.GetById(productCategoryVm.ID);
             model.UpdateProductCategory(productCategoryVm);
             model.UpdatedDate = DateTime.Now;
             _productCategoryService.Update(model);
             try
             {
                 _productCategoryService.Save();
             }
             catch (DbEntityValidationException e)
             {
                 foreach (var eve in e.EntityValidationErrors)
                 {
                     Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                       eve.Entry.Entity.GetType().Name, eve.Entry.State);
                     foreach (var ve in eve.ValidationErrors)
                     {
                         Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                                           ve.PropertyName, ve.ErrorMessage);
                     }
                 }
                 throw;
             }
             var result = Mapper.Map <ProductCategory, ProductCategoryViewModel>(model);
             return request.CreateResponse(HttpStatusCode.OK, result);
         }));
     }
     else
     {
         return(request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
     }
 }
 public ActionResult ProductDetails(int id)
 {
     if (string.IsNullOrWhiteSpace(Session["US_Name"] as string))
     {
         return(RedirectToAction("LoginUser", "User"));
     }
     else
     {
         int?vendorCount = UserPresenter.IsVendor(Session["US_Name"] as string);
         int?adminCount  = UserPresenter.IsAdmin(Session["US_Name"] as string);
         if (vendorCount == 1 || adminCount == 1)
         {
             model = pp.ProDetailsGet(id);
             return(View(model));
         }
         else
         {
             return(RedirectToAction("Index", "User"));
         }
     }
 }
Beispiel #29
0
        public static ProductCategory GetSKUList(ProductCategoryViewModel pcvm)
        {
            var JsonPCVM = Newtonsoft.Json.JsonConvert.SerializeObject(pcvm);
            var client   = new RestClient("https://apigw.qa.91dev.tw/ec/V1/SalePage/GetSKUList");
            var request  = new RestRequest(Method.POST);

            request.AddHeader("cache-control", "no-cache");
            request.AddHeader("Connection", "keep-alive");
            request.AddHeader("Content-Length", "193");
            request.AddHeader("Accept-Encoding", "gzip, deflate");
            request.AddHeader("Host", "apigw.qa.91dev.tw");
            request.AddHeader("Cache-Control", "no-cache");
            request.AddHeader("x-api-key", keyValue);
            request.AddHeader("Content-Type", "application/json");
            request.AddParameter("undefined", JsonPCVM, ParameterType.RequestBody);
            IRestResponse response = client.Execute(request);

            ProductCategory store = Newtonsoft.Json.JsonConvert.DeserializeObject <ProductCategory>(response.Content);

            return(store);
        }
 public HttpResponseMessage Create(HttpRequestMessage request, ProductCategoryViewModel productCategoryVm)
 {
     return CreateHttpRespone(request, () =>
     {
         HttpResponseMessage response = null;
         if (!ModelState.IsValid)
         {
             response = request.CreateResponse(HttpStatusCode.BadRequest, ModelState);
         }
         else
         {
             var newproductCategory = new ProductCategory();
             newproductCategory.UpdaetProductCategory(productCategoryVm);
             _productCategoryService.Add(newproductCategory);
             _productCategoryService.Save();
             var responseData = Mapper.Map<ProductCategory, ProductCategoryViewModel>(newproductCategory);
             response = request.CreateResponse(HttpStatusCode.Created, responseData);
         }
         return response;
     });
 }
Beispiel #31
0
        /// <summary>
        /// Update a given product category
        /// </summary>
        // PUT api/productcategories/5
        public HttpResponseMessage Put(int id, [FromBody] ProductCategoryViewModel productCategoryViewModel)
        {
            if (ModelState.IsValid)
            {
                ProductCategory productCategory = db.ProductCategory.Find(id);
                if (productCategory == null)
                {
                    ModelState.AddModelError("ProductCategoryId", "Not found key");
                    return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
                }
                productCategory.Name              = productCategoryViewModel.Name;
                productCategory.Description       = productCategoryViewModel.Description;
                productCategory.ProductCategoryId = productCategoryViewModel.ProductCategoryId;
                productCategory.ImagePath         = productCategoryViewModel.ImageName;
                db.Entry(productCategory).State   = EntityState.Modified;
                db.SaveChanges();
                return(new HttpResponseMessage(HttpStatusCode.OK));
            }

            return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
        }