public async Task <IActionResult> PutProductCategorie([FromRoute] int id, [FromBody] ProductCategorie ProductCategorie) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != ProductCategorie.ID) { return(BadRequest()); } _context.Entry(ProductCategorie).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!Exists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <ProductCategorie> > PostProductCategorie(ProductCategorie productCategorie) { _context.ProductCategorie.Add(productCategorie); await _context.SaveChangesAsync(); return(CreatedAtAction("GetProductCategorie", new { id = productCategorie.ID }, productCategorie)); }
public async Task <IActionResult> PutProductCategorie(Guid id, ProductCategorie productCategorie) { if (id != productCategorie.ID) { return(BadRequest()); } _context.Entry(productCategorie).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductCategorieExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public void InsertTest() { Product product = new Product(4, 4, "Coca Cola", "Zeddro", "10", 10); ProductCategorie productCategory = new ProductCategorie(1, 1, "frisdrank"); repository.Insert(product, productCategory); Assert.IsNotNull(repository.GetAllProducts().Where(x => x.ProductId == product.ProductId)); }
public ActionResult DeleteConfirmed(int id) { ProductCategorie productCategorie = db.ProductCategories.Find(id); db.ProductCategories.Remove(productCategorie); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult NieuwProduct(Product product, ProductCategorie pc) { if (ModelState.IsValid) { PR.Insert(product, pc); } return(RedirectToAction("Index")); }
private void LaadProducten() { foreach (Categorie c in admin.Categories) { ProductCategorie productCategorie = (ProductCategorie)LoadControl("UserControls/ProductCategorie.ascx"); productCategorie.Categorie = c; categorieLink.Controls.Add(productCategorie); } }
public CategorieUC(Bierkroeg b, BMSModelContainer db, ProductCategorie pc, KassaUC kuc) { InitializeComponent(); _bierkroeg = b; _db = db; _pc = pc; _kuc = kuc; ic_Producten.ItemsSource = _bierkroeg.Producten.Where(p => p.ProductCategorieId == _pc.Id).OrderBy(p => p.ProductNaam).ToList(); }
public ActionResult Edit([Bind(Include = "Id,Name")] ProductCategorie productCategorie) { if (ModelState.IsValid) { db.Entry(productCategorie).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(productCategorie)); }
public ActionResult Create([Bind(Include = "Id,Name")] ProductCategorie productCategorie) { if (ModelState.IsValid) { db.ProductCategories.Add(productCategorie); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(productCategorie)); }
public ActionResult Edit([Bind(Include = "ID,Name,MetaTitle,Alias,Description,ParentID,DisplayOrder,Image,MetaKeyword,MetaDescription,CreatedDate,CreatedBy,UpdatedDate,UpdatedBy,Status,HomeFlag")] ProductCategorie productCategorie) { if (ModelState.IsValid) { productCategorie.CreatedDate = Convert.ToDateTime(DateTime.Now.ToString()); db.Entry(productCategorie).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(productCategorie)); }
public void Delete(ProductCategorie productCategorie) { using (SqlConnection connection = Database.Connection) { string query = "DELETE FROM PRODUCTCAT WHERE id = @id"; using (SqlCommand command = new SqlCommand(query, connection)) { command.Parameters.AddWithValue("id", productCategorie.Id); command.ExecuteNonQuery(); } } }
public async Task <IActionResult> PostProductCategorie([FromBody] ProductCategorie ProductCategorie) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.ProductCategories.Add(ProductCategorie); await _context.SaveChangesAsync(); return(CreatedAtAction("GetProductCategories", new { id = ProductCategorie.ID }, ProductCategorie)); }
public ActionResult Edit(ProductCategorie productcategorie) { var editTask = Helper.Helper.WebApiClient.PutAsJsonAsync <ProductCategorie>("ProductCategorie/" + productcategorie.ID, productcategorie); editTask.Wait(); var result = editTask.Result; if (result.IsSuccessStatusCode) { return(RedirectToAction("Index")); } return(View(productcategorie)); }
/// <summary> /// Delete Product Categorie. /// </summary> // Author: Mod Nattasit // Updated: 07/07/2019 public void DeleteProductCategorie(ProductCategorieViewModel productCategorieViewModel) { #region Create Object to Delete ProductCategorie productCategorie = new ProductCategorie() { Id = productCategorieViewModel.Id, }; #endregion _unitOfWork.ProductCategories.Remove(productCategorie); }
public ActionResult Create(ProductCategorie productcategorie) { var AddTask = Helper.Helper.WebApiClient.PostAsJsonAsync <ProductCategorie>("ProductCategorie", productcategorie); AddTask.Wait(); var result = AddTask.Result; if (result.IsSuccessStatusCode) { return(RedirectToAction("Index")); } return(View(productcategorie)); }
public void Insert(ProductCategorie productCategorie) { using (SqlConnection connection = Database.Connection) { string query = "INSERT INTO PRODUCTCAT (productcat_id, naam)" + "VALUES (@productcatid, @naam)"; using (SqlCommand command = new SqlCommand(query, connection)) { command.Parameters.AddWithValue("@productcatid", productCategorie.Id); command.Parameters.AddWithValue("@naam", productCategorie.Naam); command.ExecuteNonQuery(); } } }
// GET: ProductCategorie/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ProductCategorie productCategorie = db.ProductCategories.Find(id); if (productCategorie == null) { return(HttpNotFound()); } return(View(productCategorie)); }
/// <summary> /// Save Product Categorie. /// </summary> // Author: Mod Nattasit // Updated: 07/07/2019 public void SaveProductCategorie(ProductCategorieViewModel productCategorieViewModel) { #region Create Object to Save ProductCategorie productCategorie = new ProductCategorie() { Code = productCategorieViewModel.Code, Name = productCategorieViewModel.Name, IsActive = true, CreatedDateTime = DateTime.Now }; #endregion _unitOfWork.ProductCategories.Add(productCategorie); }
public void Update(ProductCategorie productCategorie) { using (SqlConnection connection = Database.Connection) { string query = "UPDATE PRODUCTCAT" + " SET productcat_id = @productcatid, naam = @naam" + " WHERE id = @id"; using (SqlCommand command = new SqlCommand(query, connection)) { command.Parameters.AddWithValue("@id", productCategorie.Id); command.Parameters.AddWithValue("@productcatid", productCategorie.ProductCatId); command.Parameters.AddWithValue("@naam", productCategorie.Naam); command.ExecuteNonQuery(); } } }
/// <summary> /// Update Product Categorie. /// </summary> // Author: Mod Nattasit // Updated: 07/07/2019 public void UpdateProductCategorie(ProductCategorieViewModel productCategorieViewModel) { #region Create Object to Update ProductCategorie productCategorie = new ProductCategorie() { Id = productCategorieViewModel.Id, Code = productCategorieViewModel.Code, Name = productCategorieViewModel.Name, CreatedDateTime = productCategorieViewModel.CreatedDateTime, UpdatedDateTime = DateTime.Now }; #endregion _unitOfWork.ProductCategories.Update(productCategorie); }
public ActionResult Edit(Guid id) { ProductCategorie productcat = null; var product = Helper.Helper.WebApiClient.GetAsync("ProductCategorie/" + id.ToString()); product.Wait(); var result = product.Result; if (result.IsSuccessStatusCode) { var prdetoedit = result.Content.ReadAsAsync <ProductCategorie>(); prdetoedit.Wait(); productcat = prdetoedit.Result; } return(View(productcat)); }
public void Insert(Product product, ProductCategorie productCategorie) { using (SqlConnection connection = Database.Connection) { string query = "INSERT INTO Product (productcat_id, merk, serie, typenummer, prijs)" + "VALUES (@productcatid, @merk, @serie, @typenummer, @prijs)"; using (SqlCommand command = new SqlCommand(query, connection)) { command.Parameters.AddWithValue("@productcatid", productCategorie.Id); command.Parameters.AddWithValue("@merk", product.Merk); command.Parameters.AddWithValue("@serie", product.Serie); command.Parameters.AddWithValue("@typenummer", product.Typenummer); command.Parameters.AddWithValue("@prijs", product.Prijs); command.ExecuteNonQuery(); return(true); } } }
public void Update(Product product, ProductCategorie productCategorie) { using (SqlConnection connection = Database.Connection) { string query = "UPDATE Product" + " SET productcat_id = @productcatid, Merk = @merk, serie = @serie, Typnummer = @typenummer, prijs = @prijs" + " WHERE id = @id"; using (SqlCommand command = new SqlCommand(query, connection)) { command.Parameters.AddWithValue("@id", product.ProductId); command.Parameters.AddWithValue("@productcatid", productCategorie.Id); command.Parameters.AddWithValue("@merk", product.Merk); command.Parameters.AddWithValue("@serie", product.Serie); command.Parameters.AddWithValue("@typenummer", product.Typenummer); command.Parameters.AddWithValue("@prijs", product.Prijs); command.ExecuteNonQuery(); } } }
public ProductCategorie GetProductCategorieById(int id) { using (SqlConnection connection = Database.Connection) { string query = "SELECT * FROM ProductCategorie WHERE ID = @id"; using (SqlCommand command = new SqlCommand(query, connection)) { command.Parameters.AddWithValue("id", id); using (SqlDataReader reader = command.ExecuteReader()) { if (reader.Read()) { productcategorie = CreateProductCategorieFromReader(reader); return(productcategorie); } } } } return(productcategorie); }
public void Update(Product product, ProductCategorie productCategorie) { context.Update(product, productCategorie); }
public void Insert(Product product, ProductCategorie productCategorie) { context.Insert(product, productCategorie); }
// GET: ProductCategorie/Details/5 public ActionResult Details(int id) { ProductCategorie productcategorie = pcr.GetProductCategorieById(id); return(View(productcategorie)); }
public void Update(Product product, ProductCategorie productCategorie) { throw new NotImplementedException(); }
public void Insert(Product product, ProductCategorie productCategorie) { }