public async Task <IActionResult> PutThanhVienModel(int id, ThanhVienModel thanhVienModel) { if (id != thanhVienModel.Id) { return(BadRequest()); } _context.Entry(thanhVienModel).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ThanhVienModelExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <String> PutTypeAccount(int id, TypeAccount typeAccount) { if (id != typeAccount.Id) { return("0"); } _context.Entry(typeAccount).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TypeAccountExists(id)) { return("0"); } else { throw; } } return("{\"id\":" + id + ",\" stt\":\"" + typeAccount.Status + "\"}"); }
public async Task <String> PutSize(int id, Size size) { if (id != size.Id) { return("0"); } _context.Entry(size).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SizeExists(id)) { return("0"); } else { throw; } } return("{\"id\":" + id + ",\" stt\":\"" + size.Name + "\"}"); }
public async Task <IActionResult> PutTypeProduct(int id, TypeProduct typeProduct) { if (id != typeProduct.Id) { return(BadRequest()); } _context.Entry(typeProduct).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TypeProductExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <string> PutCategoryModel(int id) { var categoryModel = await _context.Categories.FindAsync(id); if (id != categoryModel.CategoryID) { return("0"); } _context.Entry(categoryModel).State = EntityState.Modified; try { if (categoryModel.Status == true) { categoryModel.Status = false; } else { categoryModel.Status = true; } await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoryModelExists(id)) { return("0"); } else { throw; } } return("{\"id\":" + id + ",\"stt\":\"" + categoryModel.Status + "\"}"); }
public async Task <string> PutProductModel(int id) { ProductModel productModel = await _context.Products.FindAsync(id); if (id != productModel.ProductID) { return("0"); } _context.Entry(productModel).State = EntityState.Modified; try { if (productModel.Status) { productModel.Status = false; } else { productModel.Status = true; } await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductModelExists(id)) { return("0"); } else { throw; } } return("{\"id\":" + id + ",\"stt\":\"" + productModel.Status + "\"}"); }