public static int UpdateBrand(BrandDTO brandDto) { string query = "UPDATE brand SET name = '" + brandDto.BrandName + "', is_active = " + brandDto.IsActive + ", updated_by = " + brandDto.UpdatedBy + ", updated_at = '" + DateTime.Now + "' WHERE id = " + brandDto.Id; try { DataTable brandsTable = DatabaseConnection.ConnectWithServer(query); if (brandsTable == null) { return(-1); } return(1); } catch (Exception) { return(-1); } }
public static int AddBrand(BrandDTO brandDto) { string query = "INSERT INTO brand (name, is_active, created_by) VALUES " + "( " + "'" + brandDto.BrandName + "'," + brandDto.IsActive + "," + brandDto.CreatedBy + ")"; try { DataTable brandsTable = DatabaseConnection.ConnectWithServer(query); if (brandsTable == null) { return(-1); } return(1); } catch (Exception) { return(-1); } }